{"name":"async-settle","version":"2.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":">= 10.13.0"},"main":"index.js","scripts":{"lint":"eslint . ","pretest":"npm run lint","test":"nyc mocha --async-only"},"dependencies":{"async-done":"^2.0.0"},"devDependencies":{"eslint":"^7.32.0","eslint-config-gulp":"^5.0.1","eslint-plugin-node":"^11.1.0","expect":"^27.4.2","mocha":"^8.4.0","nyc":"^15.1.0"},"nyc":{"reporter":["lcov","text-summary"]},"prettier":{"singleQuote":true},"keywords":["settle","async","async-done","complete","error","parallel"],"gitHead":"72b98659acbaea9ac1b5ab3b8105bac2625e2bf5","bugs":{"url":"https://github.com/gulpjs/async-settle/issues"},"homepage":"https://github.com/gulpjs/async-settle#readme","_id":"async-settle@2.0.0","_nodeVersion":"16.14.2","_npmVersion":"8.11.0","dist":{"integrity":"sha512-Obu/KE8FurfQRN6ODdHN9LuXqwC+JFIM9NRyZqJJ4ZfLJmIYN9Rg0/kb+wF70VV5+fJusTMQlJ1t5rF7J/ETdg==","shasum":"c695ad14e070f6a755d019d32d6eb38029020287","tarball":"http://registry-npm.ywwl.com/async-settle/download/async-settle-2.0.0.tgz","fileCount":4,"unpackedSize":5520,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDzjAFm3mEXUdNe5BlgWNP77YnBL+7TgifLtxbJ9uZE6wIgER4MniMQEwppCXgLB9YI4j/3uyhSp7R8wzaA6efbw/M="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJitlkKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmojmQ/8CAvu/eEwJeOTDCm//oPk7TAzodD8v+eHGGS335FNqiLhrme/\r\n/kwkzAk5neecefBVLwn3p7mAlHfgs9vbJZ+5bPrN5iHdj9et1nH5PML+2sOZ\r\nyzz3wCIEg9k3EASQf7vT5fckYaWao7xx1kB7NhTE0hbg0/7aN0tzEcpRtZZi\r\nwY3gm5a60Bd5MeF/JOTMRDpULXRVSMmLK1UwBU7NPX9z1PQ30RCXv6qgI91P\r\nzFf447LcssN+dAft8HgxPWDuG5guSAT/fYXE0WSuL2uKACE0aNCOn5MaHtPf\r\nVYwvexWEXx/A5cDEqeviKJbFHlPkQ5gcZjNV9BCUIY8iWh6+mIyIH3lXA/85\r\nODQzWjPQa8Xq1QR4hUBFdy4hRcrp3kCn2QH9ZQr0zhsAIo8K0HfPPRBCbhmH\r\nptVO5bsQ+aTRsHmQoq9C2/Z9MNM4J+94Jhm2gkbv7aGmwCewtZnuDfbC8PbT\r\nD4/bsdv6qM8EKhVYtQL6cK6zhQ79q7UK0G7SerZ9rzoA9OMC6c6nRP1SzyEG\r\nLrrWhT04GdorxgnFl2BaRZE3oNRT1qSR0H08YJiewBkcL2U3SOBYvGAt8K0y\r\nazn2ni7AhLZZY2Rorq0NzSws4oeOnKeFNOixVXn2w3YqBTijZY2affZsLLAN\r\nnMT4wLa4xN0OOWGYganqmpJ9jjYFzuMqNJI=\r\n=rMgg\r\n-----END PGP SIGNATURE-----\r\n","size":2491,"noattachment":false,"key":"/async-settle/-/async-settle-2.0.0.tgz"},"_npmUser":{"name":"phated","email":"blaine.bublitz@gmail.com"},"directories":{},"maintainers":[{"name":"yocontra","email":"yo@contra.io"},{"name":"phated","email":"blaine.bublitz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-settle_2.0.0_1656117513847_0.04545783789318891"},"_hasShrinkwrap":false,"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":1656117514020,"_cnpm_publish_time":1656117514020,"dist-tags":{"latest":"2.0.0"}}