Skip to content

Function Helpers

Utility functions for working with function operations.

FunctionDescription
composeComposes functions right-to-left: compose(f, g)(x) is equivalent to f(g(x)).
curryTransforms a multi-argument function into a chain of single-argument functions (Haskell-style currying).
debounceCreates a debounced function that delays invoking func until after delay milliseconds have elapsed since the last tim…
flipCreates a function that invokes fn with the first two arguments swapped.
identityReturns the given value unchanged Useful as a default transform, in function composition, or as a placeholder mapper.
memoizeReturns a memoized version of the function that caches results
negateCreates a function that negates the result of predicate.
noopA no-operation function that does nothing and returns undefined Useful as a default callback, placeholder, or to e…
onceCreates a function that is restricted to be called only once.
partialPartially applies arguments to a function, returning a new function that accepts the remaining arguments.
pipeComposes functions left-to-right: the output of each function is passed as input to the next.
returnOrThrowErrorReturn a value or throw an error if null or undefined.
throttleCreates a throttled function that only invokes func at most once per every wait milliseconds