{"name":"async-settle","version":"0.2.1","description":"Settle your async functions - when you need to know all your parallel functions are complete (success or failure)","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap ./test"},"repository":{"type":"git","url":"git://github.com/phated/async-settle"},"keywords":["settle","async","async-done","complete","error","parallel"],"author":{"name":"Blaine Bublitz","email":"blaine@iceddev.com","url":"http://iceddev.com/"},"license":"MIT","bugs":{"url":"https://github.com/phated/async-settle/issues"},"homepage":"https://github.com/phated/async-settle","devDependencies":{"tap":"^0.4.8"},"dependencies":{"async-done":"^0.4.0"},"gitHead":"a1571d6caa3e883758cd4f083c9a1a93eedd6f22","_id":"async-settle@0.2.1","_shasum":"767462d5738008dc75eac4246223528f21371396","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"phated","email":"blaine@iceddev.com"},"maintainers":[{"name":"phated","email":"blaine@iceddev.com"}],"dist":{"shasum":"767462d5738008dc75eac4246223528f21371396","tarball":"http://registry-npm.ywwl.com/async-settle/download/async-settle-0.2.1.tgz","integrity":"sha512-3b4i8Bf/9Zw3V/EsLtMx+qj2r0mDYotjMhzXJQxjvESOe5LgevY5KaH5BHROVZWHE7TlSY2FkeTgIgDvdkRFYQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHppoj7BQ/uBilg2mn+oxuNlslLFBv2EpSgIq/hfrnlJAiEAu2TXVR2OPdaN8/XvWj1RgfVeNdAoJBaSb41B1vQu/xM="}],"size":2167,"noattachment":false,"key":"/async-settle/-/async-settle-0.2.1.tgz"},"readme":"<p align=\"center\">\n  <a href=\"https://gulpjs.com\">\n    <img height=\"257\" width=\"114\" src=\"https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png\">\n  </a>\n</p>\n\n# async-settle\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]\n\nSettle an async function. It will always complete successfully with an object of the resulting state.\n\nHandles completion and errors for callbacks, promises, observables and streams.\n\nWill run call the function on `nextTick`. This will cause all functions to be async.\n\n## Usage\n\n### Successful completion\n\n```js\nvar asyncSettle = require('async-settle');\n\nasyncSettle(\n  function (done) {\n    // do async things\n    done(null, 2);\n  },\n  function (error, result) {\n    // `error` will ALWAYS be null on execution of the first function.\n    // `result` will ALWAYS be a settled object with the result or error of the first function.\n  }\n);\n```\n\n### Failed completion\n\n```js\nvar asyncSettle = require('async-settle');\n\nasyncSettle(\n  function (done) {\n    // do async things\n    done(new Error('Some Error Occurred'));\n  },\n  function (error, result) {\n    // `error` will ALWAYS be null on execution of the first function.\n    // `result` will ALWAYS be a settled object with the result or error of the first function.\n  }\n);\n```\n\n## API\n\n### `asyncSettle(fn, callback)`\n\nTakes a function to execute (`fn`) and a function to call on completion (`callback`).\n\n#### `fn([done])`\n\nOptionally takes a callback (`done`) to call when async tasks are complete.\n\nExecuted in the context of [`async-done`][async-done], with all errors and results being settled.\n\nCompletion is handled by [`async-done` completion and error resolution][completions].\n\n#### `callback(error, result)`\n\nCalled on completion of `fn` and recieves a settled object as the `result` argument.\n\nThe `error` argument will always be `null`.\n\n#### Settled Object\n\nSettled values have two properties, `state` and `value`.\n\n`state` has two possible options `'error'` and `'success'`.\n\n`value` will be the value passed to original callback.\n\n## License\n\nMIT\n\n<!-- prettier-ignore-start -->\n[downloads-image]: https://img.shields.io/npm/dm/async-settle.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/async-settle\n[npm-image]: https://img.shields.io/npm/v/async-settle.svg?style=flat-square\n\n[ci-url]: https://github.com/gulpjs/async-settle/actions?query=workflow:dev\n[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/async-settle/dev?style=flat-square\n\n[coveralls-url]: https://coveralls.io/r/gulpjs/async-settle\n[coveralls-image]: https://img.shields.io/coveralls/gulpjs/async-settle/master.svg?style=flat-square\n<!-- prettier-ignore-end -->\n\n<!-- prettier-ignore-start -->\n[async-done]: https://github.com/gulpjs/async-done\n[completions]: https://github.com/gulpjs/async-done#completion-and-error-resolution\n<!-- prettier-ignore-end -->\n","publish_time":1408768631440,"_cnpm_publish_time":1408768631440,"dist-tags":{"latest":"2.0.0"}}