{"_id":"callback-count","_rev":"327232","name":"callback-count","description":"Count your callbacks before continuing. A tiny control flow helper that supports dynamic counting.","dist-tags":{"latest":"0.2.0"},"maintainers":[{"name":"tjmehta","email":"tejesh.mehta@gmail.com"}],"time":{"modified":"2021-06-07T02:45:01.000Z","created":"2014-02-25T06:58:15.613Z","0.2.0":"2015-07-30T21:56:43.443Z","0.1.0":"2014-03-06T08:29:40.769Z","0.0.3":"2014-02-25T07:42:00.854Z","0.0.2":"2014-02-25T07:35:44.595Z","0.0.1":"2014-02-25T06:58:15.613Z"},"users":{"derhuerst":true,"sahilsk":true},"author":{"name":"Tejesh Mehta"},"repository":{"type":"git","url":"git+https://github.com/tjmehta/callback-count.git"},"versions":{"0.2.0":{"name":"callback-count","version":"0.2.0","description":"Count your callbacks before continuing. A tiny control flow helper that supports dynamic counting.","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/tjmehta/callback-count.git"},"keywords":["callback","count","callback","count","counter","control","flow","next","done","dynamic"],"author":{"name":"Tejesh Mehta"},"license":"MIT","bugs":{"url":"https://github.com/tjmehta/callback-count/issues"},"homepage":"https://github.com/tjmehta/callback-count","devDependencies":{"should":"^3.1.3","mocha":"^1.17.1"},"dependencies":{"exists":"^1.0.0"},"gitHead":"e4d788024f670d3d9e20f2d17c1bc64c8c77fe8d","_id":"callback-count@0.2.0","_shasum":"7652687354d4275f30beb65d013e67a64c200a47","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.10.38","_npmUser":{"name":"tjmehta","email":"tejesh.mehta@gmail.com"},"maintainers":[{"name":"tjmehta","email":"tejesh.mehta@gmail.com"}],"dist":{"shasum":"7652687354d4275f30beb65d013e67a64c200a47","size":1744,"noattachment":false,"key":"/callback-count/-/callback-count-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/callback-count/download/callback-count-0.2.0.tgz"},"directories":{},"publish_time":1438293403443,"_cnpm_publish_time":1438293403443,"_hasShrinkwrap":false},"0.1.0":{"name":"callback-count","version":"0.1.0","description":"Count your callbacks before continuing. A tiny control flow helper that supports dynamic counting.","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"https://github.com/tjmehta/callback-count.git"},"keywords":["callback","count","callback","count","counter","control","flow","next","done","dynamic"],"author":{"name":"Tejesh Mehta"},"license":"MIT","bugs":{"url":"https://github.com/tjmehta/callback-count/issues"},"homepage":"https://github.com/tjmehta/callback-count","devDependencies":{"should":"^3.1.3","mocha":"^1.17.1"},"_id":"callback-count@0.1.0","dist":{"shasum":"481e4f68966bd71637a9ae238e0e42b3059188fd","size":1683,"noattachment":false,"key":"/callback-count/-/callback-count-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/callback-count/download/callback-count-0.1.0.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"tjmehta","email":"tj_mehta@hotmail.com"},"maintainers":[{"name":"tjmehta","email":"tejesh.mehta@gmail.com"}],"directories":{},"publish_time":1394094580769,"_cnpm_publish_time":1394094580769,"_hasShrinkwrap":false},"0.0.3":{"name":"callback-count","version":"0.0.3","description":"Count your callbacks before continuing. A tiny control flow helper that supports dynamic counting.","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"https://github.com/tjmehta/callback-count.git"},"keywords":["callback","count","callback","count","counter","control","flow","next","done","dynamic"],"author":{"name":"Tejesh Mehta"},"license":"MIT","bugs":{"url":"https://github.com/tjmehta/callback-count/issues"},"homepage":"https://github.com/tjmehta/callback-count","_id":"callback-count@0.0.3","dist":{"shasum":"b3abfa8767c248bc834f13c92e488356ddce9f5c","size":851,"noattachment":false,"key":"/callback-count/-/callback-count-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/callback-count/download/callback-count-0.0.3.tgz"},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"tjmehta","email":"tj_mehta@hotmail.com"},"maintainers":[{"name":"tjmehta","email":"tejesh.mehta@gmail.com"}],"directories":{},"publish_time":1393314120854,"_cnpm_publish_time":1393314120854,"_hasShrinkwrap":false},"0.0.2":{"name":"callback-count","version":"0.0.2","description":"Count your callbacks before continuing. A tiny control flow helper that supports dynamic counting.","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"https://github.com/tjmehta/callback-count.git"},"keywords":["callback","count","callback","count","counter","control","flow","next","done","dynamic"],"author":{"name":"Tejesh Mehta"},"license":"MIT","bugs":{"url":"https://github.com/tjmehta/callback-count/issues"},"homepage":"https://github.com/tjmehta/callback-count","_id":"callback-count@0.0.2","dist":{"shasum":"33e0e5cdfb5b0e5d7a46a29d5aaf880fd938e5f8","size":852,"noattachment":false,"key":"/callback-count/-/callback-count-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/callback-count/download/callback-count-0.0.2.tgz"},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"tjmehta","email":"tj_mehta@hotmail.com"},"maintainers":[{"name":"tjmehta","email":"tejesh.mehta@gmail.com"}],"directories":{},"publish_time":1393313744595,"_cnpm_publish_time":1393313744595,"_hasShrinkwrap":false},"0.0.1":{"name":"callback-count","version":"0.0.1","description":"Count your callbacks before continuing. A tiny control flow helper that supports dynamic counting.","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"https://github.com/tjmehta/callback-count.git"},"keywords":["callback","count","callback","count","counter","control","flow","next","done","dynamic"],"author":{"name":"Tejesh Mehta"},"license":"MIT","bugs":{"url":"https://github.com/tjmehta/callback-count/issues"},"homepage":"https://github.com/tjmehta/callback-count","_id":"callback-count@0.0.1","dist":{"shasum":"f1676f33ba4ff4d03119da0ee61f02de24657c0c","size":839,"noattachment":false,"key":"/callback-count/-/callback-count-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/callback-count/download/callback-count-0.0.1.tgz"},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"tjmehta","email":"tj_mehta@hotmail.com"},"maintainers":[{"name":"tjmehta","email":"tejesh.mehta@gmail.com"}],"directories":{},"publish_time":1393311495613,"_cnpm_publish_time":1393311495613,"_hasShrinkwrap":false}},"readme":"callback-count [![Build Status](https://travis-ci.org/tjmehta/callback-count.png)](https://travis-ci.org/tjmehta/callback-count)\n==============\n\n#### Count callbacks before continuing, tiny control flow helper, allows dynamic counting. \n\n### Flow control\n```js\nvar callbackCount = require('callback-count');\nvar counter = callbackCount(done);\n\nsetTimeout(counter.inc().next, 100);\nsetTimeout(counter.inc().next, 100);\n\nfunction done (err) {\n  console.log('finished.');\n}\n```\n\n### .inc() allows you to dynamically update the number of callbacks you are expecting.\n```js\nvar callbackCount = require('callback-count');\nvar counter = callbackCount(done);\n\ncounter.inc().inc().inc();\ncounter.next().next().next();\n\nfunction done (err) {\n  console.log('finished.');\n}\n```\n\n### The constructor can take an initial value for the count expected\n```js\nvar callbackCount = require('callback-count');\nvar counter = callbackCount(3, done);\n\ncounter.next().next().next();\n\nfunction done (err) {\n  console.log('finished.');\n}\n```\n\n### .next() decrements the count and callsback when the count has reached 0\n```js\nvar counter = createCounter(3, done);\n\ncounter.next().next().next();\n\nfunction done (err) {\n  console.log(counter.count); // 0\n  console.log('finished.');\n}\n```\n\n### if .next() receives an error it will callback immediately\n```js\nvar counter = createCounter(3, done);\n\ncounter.next(new Error('boom'));\n\nfunction done (err) {\n  console.log(err.message); // boom\n}\n```\n\n### License: MIT\n","_attachments":{},"homepage":"https://github.com/tjmehta/callback-count","bugs":{"url":"https://github.com/tjmehta/callback-count/issues"},"license":"MIT"}