Appearance
Function
Some useful utils.
API
lazy
ts
Lazy<A> = () => ACreates a lazy function.
ts
lazy(1) ➔ () => 1noop
ts
() => voidA no-operation funciton.
ts
noop() ➔ undefinedidentity
ts
<A>(a: A) => AIdentity.
ts
identity(1) ➔ 1constant
ts
<A>(a: A) => Lazy<A>A thunk returns self.
ts
constant(1)() ➔ 1constTrue
ts
Lazy<boolean>A thunk returns always true.
ts
constTrue() ➔ trueconstFalse
ts
Lazy<boolean>A thunk returns always false.
ts
constFalse() ➔ falseconstNull
ts
Lazy<null>A thunk returns always null.
ts
constNull() ➔ nullconstUndefined
ts
Lazy<undefined>A thunk returns always undefined.
ts
constUndefined() ➔ undefinedconstVoid
ts
Lazy<void>A thunk returns always void.
ts
constVoid() ➔ undefinedisNullable
ts
(a: unknown) => a is null | undefinedReturns whether the value is null or undefined.
ts
isNullable(null) ➔ true
isNullable(undefined) ➔ true
isNullable(0) ➔ falseisNonNullable
ts
// Exclude null and undefined from T
type NonNullable<T> = T & {}
<A>(a: A) => a is NonNullable<A>Returns whether the value is NonNullable.
ts
isNonNullable(null) ➔ false
isNonNullable(undefined) ➔ false
isNonNullable(0) ➔ true