Share your code. Components are building blocks, you are the architect.

utils/once
v1.1.0
1.1.0
1.0.0
MIT
PUBLIC
3
Build: fail
BuildFail
Build Status: fail
Accepts a function `fn` and returns a function that guards invocation of

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use utils/once in your project
npm i @bit/bit.ramda.utils.once
Copied

once (fn:Function) : Function

Accepts a function fn and returns a function that guards invocation of fn such that fn can only ever be called once, no matter how many times the returned function is invoked. The first value calculated is returned in subsequent invocations.

Example

var addOneOnce = R.once(x => x + 1);
     addOneOnce(10); //=> 11
     addOneOnce(addOneOnce(50)); //=> 11

Argument

fn: Function

The function to wrap in a call-only-once wrapper.

Returns

Function

The wrapped function.