Skip to main content

@terascope/utils / functions

functions

Functions

isFunction()

isFunction(input): input is Function

Defined in: packages/utils/src/functions.ts:64

Verify an input is a function

Parameters

ParameterType
inputunknown

Returns

input is Function


memoize()

memoize<T>(fn): T

Defined in: packages/utils/src/functions.ts:49

A replacement for lodash memoize

Type Parameters

Type Parameter
T extends MemoizeFn

Parameters

ParameterType
fnT

Returns

T


noop()

noop(...args): any

Defined in: packages/utils/src/functions.ts:29

A simple function that does nothing but return the first argument

Parameters

ParameterType
...argsany[]

Returns

any


once()

once<T>(fn): (...args) => undefined | ReturnType<T>

Defined in: packages/utils/src/functions.ts:11

Creates a function that is only invoked once

Type Parameters

Type Parameter
T extends (...args) => any

Parameters

ParameterType
fnT

Returns

Function

Parameters
ParameterType
...argsArgType<T>
Returns

undefined | ReturnType<T>