Filters the given object with the given predicate.

Type signature

(
  f: (value: any, key: string, context: object) => boolean
) => (xs: object) => object

Examples

filter((x) => x % 2 !== 0)({
  a: 1,
  b: 2,
  c: 3,
});
// ⇒ { a: 1, c: 3 }
Try in REPL

Questions

  • How to filter an object?

TypeScript sourceJavaScript source