11 lines
299 B
Plaintext
11 lines
299 B
Plaintext
|
import { objectKeys } from '../typings/common-types.js';
|
||
|
export function objFilter(original = {}, filter = () => true) {
|
||
|
const obj = {};
|
||
|
objectKeys(original).forEach(key => {
|
||
|
if (filter(key, original[key])) {
|
||
|
obj[key] = original[key];
|
||
|
}
|
||
|
});
|
||
|
return obj;
|
||
|
}
|