Returns a function that is the logical complement of the given function, fn
.
!
) operator on the result of calling fn
with any supplied args
.const complement = fn => (...args) => !fn(...args);
const isEven = num => num % 2 === 0;
const isOdd = complement(isEven);
isOdd(2); // false
isOdd(3); // true
JavaScript, Function
Creates a function that invokes fn
with a given context, optionally prepending any additional supplied parameters to the arguments.
JavaScript, Function
Checks if at least one function returns true
for a given set of arguments.
JavaScript, Function
Creates a generator, looping over the given array indefinitely.