JavaScript Tested
Run a function only once
Wrap a function so it executes on the first call and returns the same result afterwards.
Loading snippets…
5 snippets
Wrap a function so it executes on the first call and returns the same result afterwards.
Cache results by argument so expensive pure functions only run once per distinct input.
A debounce function whose returned function keeps the parameter types and exposes cancel() and flush().
Turn a multi-argument function into one that can be called a few arguments at a time.
Chain single-argument functions left-to-right with pipe, or right-to-left with compose.