UNPKG

@prelude/cmp

Version:

Cmp module.

14 lines 594 B
/** @returns negated predicate function. */ export const negate = (f) => (a, b) => !f(a, b); /** @returns array predicate applying provided element predicate. */ export const every = (f) => (as) => { for (let i = 1; i < as.length; i++) { if (!f(as[i - 1], as[i])) { return false; } } return true; }; /** @returns `true` if difference between `a` and `b` is within epsilon (default {@link Number.EPSILON}), `false` otherwise. */ export const epsilon = (a, b, epsilon_ = Number.EPSILON) => Math.abs(a - b) <= epsilon_; //# sourceMappingURL=predicate.js.map