30 seconds of code

Function

Click on a snippet card to view the snippet.

attempt

Attempts to invoke a function with the provided arguments, returning either the result or the caught error object.

bind

Creates a function that invokes fn with a given context, optionally adding any additional supplied parameters to the beginning of the arguments.

bindKey

Creates a function that invokes the method at a given key of an object, optionally adding any additional supplied parameters to the beginning of the arguments.

chainAsync

Chains asynchronous functions.

checkProp

Given a predicate function and a prop string, this curried function will then take an object to inspect by calling the property and passing it to the predicate.

compose

Performs right-to-left function composition.

composeRight

Performs left-to-right function composition.

converge

Accepts a converging function and a list of branching functions and returns a function that applies each branching function to the arguments and the results of the branching functions are passed as arguments to the converging function.

curry

Curries a function.

debounce

Creates a debounced function that delays invoking the provided function until at least ms milliseconds have elapsed since the last time it was invoked.

defer

Defers invoking a function until the current call stack has cleared.

delay

Invokes the provided function after wait milliseconds.

functionName

Logs the name of a function.

hz

Returns the number of times a function executed per second. hz is the unit for hertz, the unit of frequency defined as one cycle per second.

memoize

Returns the memoized (cached) function.

negate

Negates a predicate function.

once

Ensures a function is called only once.

partial

Creates a function that invokes fn with partials prepended to the arguments it receives.

partialRight

Creates a function that invokes fn with partials appended to the arguments it receives.

runPromisesInSeries

Runs an array of promises in series.

sleep

Delays the execution of an asynchronous function.

throttle

Creates a throttled function that only invokes the provided function at most once per every wait milliseconds

times

Iterates over a callback n times

uncurry

Uncurries a function up to depth n.

unfold

Builds an array, using an iterator function and an initial seed value.

when

Tests a value, x, against a predicate function. If true, return fn(x). Else, return x.