npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

holding

3.1.1 • Public • Published

holding

Holding a callback for some times

NPM Version Download Status Dependencies

Installation

$ npm install holding

API

const holding = require('holding');
const done = holding(2, function() {
  console.log(this, 'called');
}, this);
 
done();
done();
done(); // it works
 
done.times; // show called times
done.called; // show fn call status

holding(n, fn, context)

  • n - {Number}

    holding times, it will execute fn after n times.

  • fn - {Function}

    holding callback.

  • context - {Any}

    fn context.

holding(n, fn, context).times

  • show called times.

holding(n, fn, context).called

  • show fn call status.

holding.assert(n, fn, context)

  • function for assertion testing, will throw error if call times out of range.

License

MIT

install

npm i holding

Downloadsweekly downloads

203

version

3.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability