js-helpers

Any

Any (Array array, [Function predicate=JsHelpers.isTruthy])

Checks if any item of *Array* array returns true from *Function* predicate.

Arguments

Array array

Collection of items to iterate over with *Function* predicate.

[Function predicate=JsHelpers.isTruthy]

Function to invoke per item of *Array* array. Iteration is stopped once predicate returns true.

Use

import { Any } from "@taystack/js-helpers";

const items = [5,6,7,8,9]
Any(items, x => (x > 8)); // true
Any(items, x => (x < 5)); // false

Source: @taystack/js-helpers hosted on GitHub Author: taystack