blob: c344ac58cacadbedaa0d2c6efff3e461be189a1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
'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
}
|