UNPKG

lightfold

Version:

lightweight scaffolding and archiving utility CLI.

12 lines (11 loc) 269 B
'use strict' module.exports = function objFilter (original, filter) { const obj = {} filter = filter || ((k, v) => true) Object.keys(original || {}).forEach((key) => { if (filter(key, original[key])) { obj[key] = original[key] } }) return obj }