Skip to content

Returns a function that will only be executed after being called N times.

License

Notifications You must be signed in to change notification settings

gearcase/invoke-after

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

invoke-after

Returns a function that will only be executed after being called N times.

MIT License

build:? coverage:?

Install

$ npm install --save invoke-after 

Usage

For more use-cases see the tests

var invokeAfter = require('invoke-after');

// invokeAfter(n, func);

var c  = 0;
var fn = invokeBefore(3, function () {
  return ++c;
});

fn(); // => undefined
fn(); // => undefined
fn(); // => 1
fn(); // => 2
fn(); // => 3

Related

  • invoke-before - Returns a function that will only be executed before 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.

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.

About

Returns a function that will only be executed after being called N times.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published