Test if any element passes the given predicate.

Type signature

(
  f: (value: any, key: string, context: object) => boolean
) => (xs: object) => 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