{"name":"async-settle","version":"0.0.0","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.2.0"},"_id":"async-settle@0.0.0","dist":{"shasum":"954c2d09d60ab6bc6f082e3cc7a7855c43dc1a83","tarball":"http://registry-npm.ywwl.com/async-settle/download/async-settle-0.0.0.tgz","integrity":"sha512-u9xlCvBez90KVSPgSu5a5gVr4rk/RZ1xAKrrCGiK6v/4H1aOo4oIQ/C5f3IQSzGqBm8D0lptby/ILINcMmAo0w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF5kQs5zRlC9b4dsAAsHyzrNR0R+oa0DAp+Z8VjoNu2gAiEAhV54jRX7bzqMxBqolkoh8rHbyCJVRv9sYvwlKj6mfAQ="}],"size":2165,"noattachment":false,"key":"/async-settle/-/async-settle-0.0.0.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"phated","email":"blaine@iceddev.com"},"maintainers":[{"name":"phated","email":"blaine@iceddev.com"}],"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":1394435951567,"_cnpm_publish_time":1394435951567,"dist-tags":{"latest":"2.0.0"}}