negate
Creates a function that negates the result of predicate.
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
predicate | function | A predicate function returning a boolean. |
Returns
Section titled “Returns”function — A new function that returns the logical negation of predicate.
Examples
Section titled “Examples”Derive isOdd from isEven
Section titled “Derive isOdd from isEven”Returns a function that inverts the boolean result of the given predicate.
Use as a filter predicate
Section titled “Use as a filter predicate”negate is ideal for inverting predicates passed to Array.filter.
