Returns a function that will only be executed before being called N times.
$ npm install --save invoke-before
For more use-cases see the tests
var invokeBefore = require('invoke-before');
// invokeBefore(n, func);
invokeBefore(1, func); // never be executed
invokeBefore(2, func); // only be executed once
invokeBefore(3, func); // only be executed twice
// ...
- invoke-after - Returns a function that will only be executed after being called N times.
- invoke-once - Restrict the given function only be invoked once.
-
invoke-fn - A faster alternative to
Function#apply
. - try-invoke - Attempts to invoke the given function, returning either the result or the caught error object.
- is-native - Checks if the given value is a native function.
- to-source-code - Converts function to its source code.
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.