Profile & property listings

This commit is contained in:
Brad Traversy
2024-07-11 16:33:42 -04:00
parent a5dbd00404
commit 4f9e8874d1
4 changed files with 145 additions and 46 deletions
+14
View File
@@ -0,0 +1,14 @@
/**
* Converts a Mongoose lean document into a serializable plain JavaScript object.
*
* @param {Object} leanDocument - The Mongoose lean document to be converted.
* @returns {Object} A plain JavaScript object that is a serializable representation of the input document.
*/
export function convertToSerializeableObject(leanDocument) {
for (const key of Object.keys(leanDocument)) {
if (leanDocument[key].toJSON && leanDocument[key].toString)
leanDocument[key] = leanDocument[key].toString();
}
return leanDocument;
}