Op Namespace
Package: @esfx/fn
Functions
add(x, y)
Add/concat (i.e. x + y
).
Declaration
export declare function add(x: number, y: number): number;
Parameters
- x
- number
- y
- number
Returns
add(x, y)
Declaration
export declare function add(x: bigint, y: bigint): bigint;
Parameters
- x
- bigint
- y
- bigint
Returns
add(x, y)
Declaration
export declare function add(x: string, y: string | number | boolean | object | null | undefined): string;
Parameters
- x
- string
- y
- string | number | boolean | object | null | undefined
Returns
add(x, y)
Declaration
export declare function add(x: string | number | boolean | object | null | undefined, y: string): string;
Parameters
- x
- string | number | boolean | object | null | undefined
- y
- string
Returns
and(x, y)
Logical AND (i.e. x && y
).
Declaration
export declare function and(x: boolean, y: boolean): boolean;
Parameters
- x
- boolean
- y
- boolean
Returns
bitand(x, y)
Bitwise AND (i.e. x & y
).
Declaration
export declare function bitand(x: number, y: number): number;
Parameters
- x
- number
- y
- number
Returns
bitand(x, y)
Declaration
export declare function bitand(x: bigint, y: bigint): bigint;
Parameters
- x
- bigint
- y
- bigint
Returns
bitnot(x)
Bitwise NOT (i.e. ~x
).
Declaration
export declare function bitnot(x: number): number;
Parameters
- x
- number
Returns
bitnot(x)
Declaration
export declare function bitnot(x: bigint): bigint;
Parameters
- x
- bigint
Returns
bitor(x, y)
Bitwise OR (i.e. x | y
).
Declaration
export declare function bitor(x: number, y: number): number;
Parameters
- x
- number
- y
- number
Returns
bitor(x, y)
Declaration
export declare function bitor(x: bigint, y: bigint): bigint;
Parameters
- x
- bigint
- y
- bigint
Returns
bitxor(x, y)
Bitwise XOR (i.e. x ^ y
).
Declaration
export declare function bitxor(x: number, y: number): number;
Parameters
- x
- number
- y
- number
Returns
bitxor(x, y)
Declaration
export declare function bitxor(x: bigint, y: bigint): bigint;
Parameters
- x
- bigint
- y
- bigint
Returns
coalesce(x, y)
Nullish Coalesce (i.e. x ?? y
).
Declaration
export declare function coalesce<T, U>(x: T, y: U): NonNullable<T> | U;
Type Parameters
- T
- U
Parameters
- x
- T
- y
- U
Returns
div(x, y)
Divide (i.e. x / y
).
Declaration
export declare function div(x: number, y: number): number;
Parameters
- x
- number
- y
- number
Returns
div(x, y)
Declaration
export declare function div(x: bigint, y: bigint): bigint;
Parameters
- x
- bigint
- y
- bigint
Returns
eq(x, y)
Strict equality (i.e. x === y
).
Declaration
export declare function eq<T>(x: T, y: T): boolean;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
ge(x, y)
Relational greater-than-equals (i.e. x >= y
).
Declaration
export declare function ge<T>(x: T, y: T): boolean;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
gt(x, y)
Relational greater-than (i.e. x > y
).
Declaration
export declare function gt<T>(x: T, y: T): boolean;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
le(x, y)
Relational less-than-equals (i.e. x <= y
).
Declaration
export declare function le<T>(x: T, y: T): boolean;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
lt(x, y)
Relational less-than (i.e. x < y
).
Declaration
export declare function lt<T>(x: T, y: T): boolean;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
max(x, y)
Relational maximum (i.e. x >= y ? x : y
).
Declaration
export declare function max<T>(x: T, y: T): T;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
maxBy(x, y, f)
Relational maximum using a provided selector (i.e. f(x) <= f(y) ? x : y
).
Declaration
export declare function maxBy<T, K>(x: T, y: T, f: (v: T) => K): T;
Type Parameters
- T
- K
Parameters
- x
- T
- y
- T
- f
- (v: T) => K
Returns
min(x, y)
Relational minimum (i.e. x <= y ? x : y
).
Declaration
export declare function min<T>(x: T, y: T): T;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
minBy(x, y, f)
Relational minimum using a provided selector (i.e. f(x) <= f(y) ? x : y
).
Declaration
export declare function minBy<T, K>(x: T, y: T, f: (v: T) => K): T;
Type Parameters
- T
- K
Parameters
- x
- T
- y
- T
- f
- (v: T) => K
Returns
mod(x, y)
Modulo (i.e. x % y
).
Declaration
export declare function mod(x: number, y: number): number;
Parameters
- x
- number
- y
- number
Returns
mod(x, y)
Declaration
export declare function mod(x: bigint, y: bigint): bigint;
Parameters
- x
- bigint
- y
- bigint
Returns
mul(x, y)
Multiply (i.e. x * y
).
Declaration
export declare function mul(x: number, y: number): number;
Parameters
- x
- number
- y
- number
Returns
mul(x, y)
Declaration
export declare function mul(x: bigint, y: bigint): bigint;
Parameters
- x
- bigint
- y
- bigint
Returns
ne(x, y)
Strict equality (i.e. x !== y
).
Declaration
export declare function ne<T>(x: T, y: T): boolean;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
neg(x)
Negate (i.e. -x
).
Declaration
export declare function neg(x: number): number;
Parameters
- x
- number
Returns
neg(x)
Declaration
export declare function neg(x: bigint): bigint;
Parameters
- x
- bigint
Returns
not(x)
Logical NOT (i.e. !x
).
Declaration
export declare function not(x: boolean): boolean;
Parameters
- x
- boolean
Returns
operator(op)
Declaration
export declare function operator<K extends keyof Operators>(op: K): Operators[K];
Type Parameters
- K
Parameters
- op
- K
Returns
operator(op, arity)
Declaration
export declare function operator<K extends keyof UnaryOperators>(op: K, arity: 1): UnaryOperators[K];
Type Parameters
- K
Parameters
- op
- K
- arity
- 1
Returns
operator(op, arity)
Declaration
export declare function operator<K extends keyof BinaryOperators>(op: K, arity: 2): BinaryOperators[K];
Type Parameters
- K
Parameters
- op
- K
- arity
- 2
Returns
or(x, y)
Logical OR (i.e. x || y
).
Declaration
export declare function or(x: boolean, y: boolean): boolean;
Parameters
- x
- boolean
- y
- boolean
Returns
plus(x)
Unary plus (i.e. +x
).
Declaration
export declare function plus(x: number): number;
Parameters
- x
- number
Returns
pow(x, y)
Exponentiate (i.e. x ** y
).
Declaration
export declare function pow(x: number, y: number): number;
Parameters
- x
- number
- y
- number
Returns
pow(x, y)
Declaration
export declare function pow(x: bigint, y: bigint): bigint;
Parameters
- x
- bigint
- y
- bigint
Returns
req(x, y)
Relational equals (i.e. x >= y && x <= y
).
Declaration
export declare function req<T>(x: T, y: T): boolean;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
rne(x, y)
Relational not-equals (i.e. x < y || x > y
).
Declaration
export declare function rne<T>(x: T, y: T): boolean;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
sal(x, n)
Left shift (i.e. x << n
).
Declaration
export declare function shl(x: number, n: number): number;
Parameters
- x
- number
- n
- number
Returns
sal(x, n)
Declaration
export declare function shl(x: bigint, n: bigint): bigint;
Parameters
- x
- bigint
- n
- bigint
Returns
sar(x, n)
Signed right shift (i.e. x >> n
).
Declaration
export declare function sar(x: number, n: number): number;
Parameters
- x
- number
- n
- number
Returns
sar(x, n)
Declaration
export declare function sar(x: bigint, n: bigint): bigint;
Parameters
- x
- bigint
- n
- bigint
Returns
shl(x, n)
Left shift (i.e. x << n
).
Declaration
export declare function shl(x: number, n: number): number;
Parameters
- x
- number
- n
- number
Returns
shl(x, n)
Declaration
export declare function shl(x: bigint, n: bigint): bigint;
Parameters
- x
- bigint
- n
- bigint
Returns
shr(x, n)
Unsigned right shift (i.e. x >>> n
).
Declaration
export declare function shr(x: number, n: number): number;
Parameters
- x
- number
- n
- number
Returns
shr(x, n)
Declaration
export declare function shr(x: bigint, n: bigint): bigint;
Parameters
- x
- bigint
- n
- bigint
Returns
sub(x, y)
Subtract (i.e. x - y
).
Declaration
export declare function sub(x: number, y: number): number;
Parameters
- x
- number
- y
- number
Returns
sub(x, y)
Declaration
export declare function sub(x: bigint, y: bigint): bigint;
Parameters
- x
- bigint
- y
- bigint
Returns
weq(x, y)
Weak equality (i.e. x == y
).
Declaration
export declare function weq<T>(x: T, y: T): boolean;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
wne(x, y)
Weak inequality (i.e. x != y
).
Declaration
export declare function wne<T>(x: T, y: T): boolean;
Type Parameters
- T
Parameters
- x
- T
- y
- T
Returns
xor(x, y)
Logical XOR (i.e. x ? !y : y
).
Declaration
export declare function xor(x: boolean, y: boolean): boolean;
Parameters
- x
- boolean
- y
- boolean
Returns
Type Aliases
BinaryOperators
Declaration
export declare type BinaryOperators = typeof binaryOperators;
Operators
Declaration
export declare type Operators = typeof unspecifiedOperators;
UnaryOperators
Declaration
export declare type UnaryOperators = typeof unaryOperators;