The before
function in Lodash allows you to create a function that will be called at most n-1
times. Once the function has been called n-1
times, the result of the last invocation will be returned on all subsequent calls.
Here's an example usage of the before
function:
index.tsx355 chars13 lines
In this example, myFunction
will only be called twice. After that, the call to myFunctionTwice()
will not execute the function and instead simply return the result of the second invocation.
gistlibby LogSnag