{"_id":"drainer","_rev":"1745652","name":"drainer","description":"Queue and drain an array of functions in series","dist-tags":{"latest":"0.2.1"},"maintainers":[{"name":"scottcorgan","email":"scottcorgan@gmail.com"}],"time":{"modified":"2026-11-19T14:25:43.000Z","created":"2013-12-03T22:37:15.498Z","0.2.1":"2014-01-28T01:03:18.466Z","0.2.0":"2014-01-28T00:57:16.159Z","0.1.0":"2013-12-03T22:37:15.498Z"},"users":{},"author":{"name":"Scott Corgan"},"repository":{"type":"git","url":"https://github.com/scottcorgan/drainer.git"},"versions":{"0.2.1":{"name":"drainer","version":"0.2.1","description":"Queue and drain an array of functions in series","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"https://github.com/scottcorgan/drainer.git"},"keywords":["queue","drain","series","array","async"],"author":{"name":"Scott Corgan"},"license":"MIT","bugs":{"url":"https://github.com/scottcorgan/drainer/issues"},"devDependencies":{"tape":"~2.3.0","sinon":"~1.7.3"},"dependencies":{"as-array":"~0.1.1"},"_id":"drainer@0.2.1","dist":{"shasum":"31530d6f71f42643d70afeb5ac4f7291d057d2ad","tarball":"http://registry-npm.ywwl.com/drainer/download/drainer-0.2.1.tgz","integrity":"sha512-50Tv9zbFTEnb+2Ngh1pIHoQiiJsdgj8RqGIjW2XgnLD8YUOdHumIwMOLhrLU7EWukAHvaHugZ21+tNPTu2byFw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE9bmkbPZv05d7D20ROpQc24SpWQZ1QYuXiQxznLF9CqAiEA5CdpeRz1UC8hL1FifD6bwP4VGPECDzHd3cSY8VDy5Cs="}],"size":1911,"noattachment":false,"key":"/drainer/-/drainer-0.2.1.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"scottcorgan","email":"scottcorgan@gmail.com"},"maintainers":[{"name":"scottcorgan","email":"scottcorgan@gmail.com"}],"publish_time":1390870998466,"_cnpm_publish_time":1390870998466},"0.2.0":{"name":"drainer","version":"0.2.0","description":"Queue and drain an array of functions in series","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"https://github.com/scottcorgan/drainer.git"},"keywords":["queue","drain","series","array","async"],"author":{"name":"Scott Corgan"},"license":"MIT","bugs":{"url":"https://github.com/scottcorgan/drainer/issues"},"devDependencies":{"tape":"~2.3.0","sinon":"~1.7.3"},"dependencies":{"as-array":"~0.1.1"},"_id":"drainer@0.2.0","dist":{"shasum":"f828b5662558e56999f75d337f91c1907c995f74","tarball":"http://registry-npm.ywwl.com/drainer/download/drainer-0.2.0.tgz","integrity":"sha512-TKYNNGaB/NzFpZJfVhymYzqzT6KyrsQeaFEYnl7yY+er788Nhc03pIO1TGOvpnU9mT4bqy9CHXiqHgVL3W31AQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIELHssU8LPV9y1osfUjg+VnEDsDWy/m/pkPb4XI+0Qp7AiAqmT42MJ9BF5fR4neNtDahtqCJd+mECiy53t4/SUITSg=="}],"size":1798,"noattachment":false,"key":"/drainer/-/drainer-0.2.0.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"scottcorgan","email":"scottcorgan@gmail.com"},"maintainers":[{"name":"scottcorgan","email":"scottcorgan@gmail.com"}],"publish_time":1390870636159,"_cnpm_publish_time":1390870636159},"0.1.0":{"name":"drainer","version":"0.1.0","description":"Queue and drain an array of functions in series","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"https://github.com/scottcorgan/drainer.git"},"keywords":["queue","drain","series","array","async"],"author":{"name":"Scott Corgan"},"license":"MIT","bugs":{"url":"https://github.com/scottcorgan/drainer/issues"},"devDependencies":{"tape":"~2.3.0","sinon":"~1.7.3"},"_id":"drainer@0.1.0","dist":{"shasum":"efeaae06a3f92c4cb20e3f249528c59d3695843d","tarball":"http://registry-npm.ywwl.com/drainer/download/drainer-0.1.0.tgz","integrity":"sha512-BRs6NKjE9bhVRYjoxEGpXr22FztMQp9uoZtuCmrTqtig3UUvtGrH7Vpwpp10GLdS4XtljhvIl+yHrujMK/sLOg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzgbPkVIOHQ1fChouBxgWPTrQu8u4u5/46edh2H7ZNewIgTYK1Ib4ZHwoAW6CthFBarF/ZdOJrm+YIm/dm3fucXO0="}],"size":1474,"noattachment":false,"key":"/drainer/-/drainer-0.1.0.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"scottcorgan","email":"scottcorgan@gmail.com"},"maintainers":[{"name":"scottcorgan","email":"scottcorgan@gmail.com"}],"publish_time":1386110235498,"_cnpm_publish_time":1386110235498}},"readme":"# drainer\n\nQueue and drain an array of functions in series.\n\n## Install\n\n```\nnpm install drainer --save\n```\n\n## Usage\n\n```js\nvar drainer = require('drainer');\n\ndrainer([\n  function (next) {\n    next();\n  },\n  function (next) {\n    next(null, 'some value');\n  },\n  function (arg1, next) {\n    // arg1 == 'some value'\n    next(null, 'final value');\n  }\n], function (err, finalValue) {\n  // finalValue == 'final value';\n});\n```\n\n### Handling Errors\n\nEach function in the array recieves a callback, `next()`, to call when done. If only one argument is passed into that callback, it will assume that it is an error, exit the chain, and call the final callback with the error.\n\n### Default Arguments\n\nIf you have arguments that you want to pass to each method without explicitly passing them each method, you can easily do that like this:\n\n```js\nvar drainer = require('drainer');\nvar drain = drainer([\n  function (defaultArg1, defaultArg2, next) {\n    next();\n  },\n  function (defaultArg1, defaultArg2, next) {\n    next();\n  }\n]);\n\ndrainer('defaultArg1', 'defaultArg2', function (err, defaultArg1, defaultArg2) {\n  \n});\n```\n\n### Passing Arguments from Method to Method\n\nIf you call the `next()` callback in the queued function with the first argument as `null`, any argument following will be passed to the next function in the queue.\n\nThe final callback will recieve any values passed from the last function in the function queue.\n\n## Run Tests\n\n```\nnpm install\nnpm test\n```\n","_attachments":{},"bugs":{"url":"https://github.com/scottcorgan/drainer/issues"},"license":"MIT"}