UNPKG

nodejs-rigorous

Version:
22 lines (14 loc) 397 B
module.exports = (attributes, filterLevel) => { const filter = { _id: 1, created_at: 1, updated_at: 1, }; Object.keys(attributes).forEach((key) => { const attributeFilter = attributes[key].filter.level; if (attributeFilter <= filterLevel) { filter[key] = 1; } }); return filter; };