{"name":"async-settle","version":"1.0.0","description":"Settle an async function.","author":{"name":"Gulp Team","email":"team@gulpjs.com","url":"http://gulpjs.com/"},"contributors":[{"name":"Blaine Bublitz","email":"blaine.bublitz@gmail.com"}],"repository":{"type":"git","url":"git+https://github.com/gulpjs/async-settle.git"},"license":"MIT","engines":{"node":">= 0.10"},"main":"index.js","files":["index.js","LICENSE"],"scripts":{"lint":"eslint . && jscs index.js test/","pretest":"npm run lint","test":"mocha --async-only","cover":"istanbul cover _mocha --report lcovonly","coveralls":"npm run cover && istanbul-coveralls"},"dependencies":{"async-done":"^1.2.2"},"devDependencies":{"eslint":"^1.7.3","eslint-config-gulp":"^2.0.0","expect":"^1.19.0","istanbul":"^0.4.3","istanbul-coveralls":"^1.0.3","jscs":"^2.3.5","jscs-preset-gulp":"^1.0.0","mocha":"^2.4.5"},"keywords":["settle","async","async-done","complete","error","parallel"],"gitHead":"96fc96809f72f179358279cc85318f73ad12db53","bugs":{"url":"https://github.com/gulpjs/async-settle/issues"},"homepage":"https://github.com/gulpjs/async-settle#readme","_id":"async-settle@1.0.0","_shasum":"1d0a914bb02575bec8a8f3a74e5080f72b2c0c6b","_from":".","_npmVersion":"2.15.2","_nodeVersion":"0.10.41","_npmUser":{"name":"phated","email":"blaine.bublitz@gmail.com"},"maintainers":[{"name":"phated","email":"blaine@iceddev.com"}],"dist":{"shasum":"1d0a914bb02575bec8a8f3a74e5080f72b2c0c6b","tarball":"http://registry-npm.ywwl.com/async-settle/download/async-settle-1.0.0.tgz","npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2j5rCRA9TVsSAnZWagAAVdwQAJO/mNFGyYmMQ7ztUrEs\nmgIsBoz4SrBr/BxQziRJlyrLJNAljVLMLHaZ/ap8PKm4VYsBv6PKBWpQMWb0\nn8Hz34w2i4pKr0mTAroZ3ORB2mOg2x+8MZOx1Pnhb2z/vh4zMOGdsjD3yvet\n4ENrcMBQdejSsi8AcZWZ0wVQJEt6B1n7O0ccZpR6d48dsMuEYDcbEX+DnXWO\ntR7iCqGjOKmOFdke9kq/CFURadDGPmZu8GODOaldqI8BfsuGKTTMbBlUPjin\n7eBe/BlQkI6R1fZIWmmTIOP2oRzNLdARL6ARoUD0/2PusDybQt1RmfHoCejr\nGtGSnQ02iUvIqHBcjJYwf07MPj4heZLAtHzGOvlPIxYQF3qGQz6rnHiXWMBh\ncXnSzNkjv1a6ojxMLNuLFYt6AcNqfRRwUESj1eP86GHRHla5WrqiVa9WisyL\nOW6Jix/DAV1db1G0ahO4Q7061SSHOq5utjO5h1bK8i1P/9fmLcVvZhULU0JX\n0sqVuQBNfS5sgAvGGaiicJsJACkIUtJwW0mzswuvQmXjCC3fxMLUYCi8aRuW\nDcdz4fouXsvJP0UpMTsOBhJrWC9xGcfnfwoEtqw/ONL5IQBe+aluso6uyr9l\nqE8OlNIXqXBxeMPqQAGPRUb69LHvUvv5EKSeEXcau/e5YaWnPpc3rkn4TKPk\nr+ne\r\n=A9s+\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-VPXfB4Vk49z1LHHodrEQ6Xf7W4gg1w0dAPROHngx7qgDjqmIQ+fXmwgGXTW/ITLai0YLSvWepJOP9EVpMnEAcw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFjMGGztUot/Xl/3fi83o8sQ4Hx0cx4noTPjfLj+LmwXAiEA/9xae5G+Kh6GDgGRUTeNgp/b4XG1yWpxPJCDtVtd0H0="}],"size":2552,"noattachment":false,"key":"/async-settle/-/async-settle-1.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/async-settle-1.0.0.tgz_1466975095176_0.044924013782292604"},"directories":{},"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":1466975099171,"_cnpm_publish_time":1466975099171,"dist-tags":{"latest":"2.0.0"}}