Function Helpers
Utility functions for working with function operations.
Functions
Section titled “Functions”| Function | Description |
|---|---|
compose | Composes functions right-to-left: `compose(f, g)(x)` is equivalent to `f(g(x))`. |
curry | Transforms a multi-argument function into a chain of single-argument functions (Haskell-style currying). |
debounce | Creates a debounced function that delays invoking func until after delay milliseconds have elapsed since the last tim… |
flip | Creates a function that invokes `fn` with the first two arguments swapped. |
identity | Returns the given value unchanged Useful as a default transform, in function composition, or as a placeholder mapper. |
memoize | Returns a memoized version of the function that caches results. |
negate | Creates a function that negates the result of `predicate`. |
noop | A no-operation function that does nothing and returns `undefined` Useful as a default callback, placeholder, or to e… |
once | Creates a function that is restricted to be called only once. |
partial | Partially applies arguments to a function, returning a new function that accepts the remaining arguments. |
pipe | Composes functions left-to-right: the output of each function is passed as input to the next. |
returnOrThrowError | Return a value or throw an error if null or undefined. |
throttle | Creates a throttled function that only invokes func at most once per every wait milliseconds |
unary | Creates a function that calls `fn` with only its first argument, discarding any others. |