init
This commit is contained in:
1 parent
10dc3e5ffe
commit
ef35a8aa6c
12 files changed
+3819
No files matched your search
@@ -0,0 +1,22 @@
|
||||
const getAnswer = (error, body = null, success = true) => {
|
||||
if (error) {
|
||||
return { success: false, error, body }
|
||||
} else {
|
||||
return { success, body }
|
||||
}
|
||||
}
|
||||
|
||||
function cleanId(entity) {
|
||||
if (Array.isArray(entity)) {
|
||||
return entity.map(cleanId)
|
||||
}
|
||||
|
||||
const { _id, ...other } = entity;
|
||||
|
||||
return { ...other, id: _id };
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAnswer,
|
||||
cleanId,
|
||||
}
|
||||
Reference in new issue
Block a user