Skip to main content

@terascope/utils / functions

functions

Functions

isFunction()

isFunction(input): input is Function

Verify an input is a function

Parameters

ParameterType
inputunknown

Returns

input is Function

Source

packages/utils/src/functions.ts:64


memoize()

memoize<T>(fn): T

A replacement for lodash memoize

Type parameters

Type parameter
T extends MemoizeFn

Parameters

ParameterType
fnT

Returns

T

Source

packages/utils/src/functions.ts:49


noop()

noop(...args): any

A simple function that does nothing but return the first argument

Parameters

ParameterType
...argsany[]

Returns

any

Source

packages/utils/src/functions.ts:29


once()

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

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

ReturnType<T> | undefined

Source

packages/utils/src/functions.ts:11