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, }