Test if any element passes the given predicate.

Type signature

<T>(f: (value: T, key: string, context: object) => boolean) => (xs: GenericObject<T>) => boolean

Examples

some((x) => x >= 4)({
  x: 5,
  y: 3,
  z: 0,
});
// ⇒ true
Try in REPL
some((x) => x < 0)({
  x: 5,
  y: 3,
  z: 0,
});
// ⇒ false
Try in REPL

Questions

  • How to check if any entry in an object passes a given predicate?

TypeScript sourceJavaScript source