Skip to content

xdash API Reference v0.5.14


xdash API Reference / not

Function: not()

not<Args>(fn): (...args) => boolean

Defined in: src/function.ts:43

Negates the result of a function.

Type Parameters

Args

Args extends readonly unknown[]

Parameters

fn

(...args) => boolean

function to negate

Returns

a function that negates the result of the input function

(...args): boolean

Parameters

args

...Args

Returns

boolean

Example

ts
const isEven = (n: number) => n % 2 === 0
const isOdd = not(isEven)
isOdd(2) // returns false

Released under the MIT License.