@monstermann/fn
Version:
A utility library for TypeScript.
31 lines (29 loc) • 471 B
JavaScript
import { dfdlT } from "@monstermann/dfdl";
//#region src/function/not.ts
/**
* `not(predicate)`
*
* Negates the result of a predicate function.
*
* ```ts
* not(5, (x) => x > 10); // true
* not(15, (x) => x > 10); // false
* ```
*
* ```ts
* pipe(
* 5,
* not((x) => x > 10),
* ); // true
*
* pipe(
* 15,
* not((x) => x > 10),
* ); // false
* ```
*/
const not = dfdlT((target, predicate) => {
return !predicate(target);
}, 2);
//#endregion
export { not };