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