Creates a new object containing only the keys from the original object that satisfy the given predicate function.
The source object to filter keys from.
A function that receives each key and returns true to keep it.
true
A new object containing only the key-value pairs where the key passed the predicate.
const obj = { a: 1, b: 2, c: 3 };const filtered = filterKeys(obj, key => key !== 'b');console.log(filtered); // { a: 1, c: 3 } Copy
const obj = { a: 1, b: 2, c: 3 };const filtered = filterKeys(obj, key => key !== 'b');console.log(filtered); // { a: 1, c: 3 }
1.1.0
Creates a new object containing only the keys from the original object that satisfy the given predicate function.