Skip to main content

@rtorcato/js-common / functions

functions

Functions

once()

once<T>(fn): T

Defined in: functions/index.ts:7

Returns a function that only calls the original function once.

Type Parameters

T

T extends (...args) => any

Parameters

fn

T

The function to wrap.

Returns

T


debounce()

debounce<T>(fn, wait): T

Defined in: functions/index.ts:26

Returns a debounced version of a function.

Type Parameters

T

T extends (...args) => void

Parameters

fn

T

The function to debounce.

wait

number

Milliseconds to wait.

Returns

T


throttle()

throttle<T>(fn, wait): T

Defined in: functions/index.ts:41

Returns a throttled version of a function.

Type Parameters

T

T extends (...args) => void

Parameters

fn

T

The function to throttle.

wait

number

Milliseconds to wait between calls.

Returns

T


compose()

compose<T>(...fns): (arg) => T

Defined in: functions/index.ts:57

Composes functions from right to left.

Type Parameters

T

T

Parameters

fns

...(arg) => T[]

Functions to compose.

Returns

(arg) => T


pipe()

pipe<T>(...fns): (arg) => T

Defined in: functions/index.ts:66

Pipes functions from left to right.

Type Parameters

T

T

Parameters

fns

...(arg) => T[]

Functions to pipe.

Returns

(arg) => T