{"_id":"asyncro","_rev":"250130","name":"asyncro","description":"Asynchronous Array Utilities (for await)","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"time":{"modified":"2021-06-03T16:11:52.000Z","created":"2016-10-21T04:46:43.279Z","3.0.0":"2018-01-22T22:33:58.047Z","2.0.1":"2016-10-23T04:02:05.515Z","2.0.0":"2016-10-23T03:52:40.996Z","1.0.0":"2016-10-21T04:46:43.279Z"},"users":{"denji":true,"program247365":true,"developit":true},"author":{"name":"Jason Miller","email":"jason@developit.ca"},"repository":{"type":"git","url":"git+https://github.com/developit/asyncro.git"},"versions":{"3.0.0":{"name":"asyncro","version":"3.0.0","description":"Asynchronous Array Utilities (for await)","main":"dist/asyncro.js","module":"dist/asyncro.m.js","source":"src/index.js","scripts":{"build":"microbundle && npm run -s docs","prepublish":"npm run -s build && npm t","transpile":"rollup -c rollup.config.js -m ${npm_package_main}.map -f umd -n $npm_package_name $npm_package_jsnext_main -o $npm_package_main","docs":"documentation readme src/*.js -q -s API && documentation build src/*.js -f html -o docs","test":"eslint src test && npm run -s build && ava --verbose","release":"npm run -s build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"eslintConfig":{"extends":"eslint-config-developit"},"repository":{"type":"git","url":"git+https://github.com/developit/asyncro.git"},"keywords":["async","await","arrays"],"files":["src","dist"],"author":{"name":"Jason Miller","email":"jason@developit.ca"},"license":"MIT","bugs":{"url":"https://github.com/developit/asyncro/issues"},"homepage":"https://github.com/developit/asyncro","devDependencies":{"ava":"^0.16.0","documentation":"^4.0.0-beta11","eslint":"^3.19.0","eslint-config-developit":"^1.1.1","microbundle":"^0.3.1","sinon":"^1.17.6"},"gitHead":"b720a32ac59bf1329991e39f6cf339fe10c14e76","_id":"asyncro@3.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.2","_npmUser":{"name":"developit","email":"jason@developit.ca"},"dist":{"shasum":"3c7a732e263bc4a42499042f48d7d858e9c0134e","size":4460,"noattachment":false,"key":"/asyncro/-/asyncro-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/asyncro/download/asyncro-3.0.0.tgz"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/asyncro-3.0.0.tgz_1516660437904_0.15735005727037787"},"directories":{},"publish_time":1516660438047,"_cnpm_publish_time":1516660438047,"_hasShrinkwrap":false},"2.0.1":{"name":"asyncro","version":"2.0.1","description":"Asynchronous Array Utilities (for await)","main":"dist/asyncro.js","jsnext:main":"src/index.js","minified:main":"dist/asyncro.min.js","scripts":{"clean":"rimraf dist/","build":"npm-run-all --silent clean transpile minify docs size","prepublish":"npm-run-all build test","transpile":"rollup -c rollup.config.js -m ${npm_package_main}.map -f umd -n $npm_package_name $npm_package_jsnext_main -o $npm_package_main","minify":"uglifyjs $npm_package_main -cm -o $npm_package_minified_main -p relative --in-source-map ${npm_package_main}.map --source-map ${npm_package_minified_main}.map","size":"size=$(gzip-size $npm_package_minified_main) && echo \"gzip size: $size / $(pretty-bytes $size)\"","docs":"documentation readme --section API -q && documentation build -f html -o docs -q","test":"ava --verbose","lint":"eslint {src,test}","release":"npm run -s build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"repository":{"type":"git","url":"git+https://github.com/developit/asyncro.git"},"keywords":["async","await","arrays"],"files":["src","dist"],"author":{"name":"Jason Miller","email":"jason@developit.ca"},"license":"MIT","bugs":{"url":"https://github.com/developit/asyncro/issues"},"homepage":"https://github.com/developit/asyncro","devDependencies":{"ava":"^0.16.0","babel-cli":"^6.14.0","babel-plugin-async-to-promises":"^1.0.5","babel-preset-es2015":"^6.14.0","documentation":"^4.0.0-beta11","eslint":"^3.8.1","gzip-size-cli":"^1.0.0","npm-run-all":"^3.1.1","pretty-bytes-cli":"^2.0.0","rollup":"^0.36.3","rollup-plugin-babel":"^2.6.1","rollup-plugin-es3":"^1.0.3","rollup-plugin-memory":"^2.0.0","sinon":"^1.17.6","uglify-js":"^2.7.3"},"gitHead":"cbfc6d654eca2e2fb7dd97215ef6eb8f04212a0f","_id":"asyncro@2.0.1","_shasum":"441783c134d0e13588af894bd4f8d1c834630d5d","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"developit","email":"jason@developit.ca"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"dist":{"shasum":"441783c134d0e13588af894bd4f8d1c834630d5d","size":6017,"noattachment":false,"key":"/asyncro/-/asyncro-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/asyncro/download/asyncro-2.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/asyncro-2.0.1.tgz_1477195324254_0.019518096931278706"},"directories":{},"publish_time":1477195325515,"_cnpm_publish_time":1477195325515,"_hasShrinkwrap":false},"2.0.0":{"name":"asyncro","version":"2.0.0","description":"Asynchronous Array Utilities (for await)","main":"dist/asyncro.js","jsnext:main":"src/index.js","minified:main":"dist/asyncro.min.js","scripts":{"clean":"rimraf dist/","build":"npm-run-all --silent clean transpile minify docs size","prepublish":"npm-run-all build test","transpile":"rollup -c rollup.config.js -m ${npm_package_main}.map -f umd -n $npm_package_name $npm_package_jsnext_main -o $npm_package_main","minify":"uglifyjs $npm_package_main -cm -o $npm_package_minified_main -p relative --in-source-map ${npm_package_main}.map --source-map ${npm_package_minified_main}.map","size":"size=$(gzip-size $npm_package_minified_main) && echo \"gzip size: $size / $(pretty-bytes $size)\"","docs":"documentation readme src/index.js --section API -q","test":"ava --verbose","lint":"eslint {src,test}","release":"npm run -s build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"repository":{"type":"git","url":"git+https://github.com/developit/asyncro.git"},"keywords":["async","await","arrays"],"author":{"name":"Jason Miller","email":"jason@developit.ca"},"license":"MIT","bugs":{"url":"https://github.com/developit/asyncro/issues"},"homepage":"https://github.com/developit/asyncro","devDependencies":{"ava":"^0.16.0","babel-cli":"^6.14.0","babel-plugin-async-to-promises":"^1.0.5","babel-preset-es2015":"^6.14.0","documentation":"^4.0.0-beta11","eslint":"^3.8.1","gzip-size-cli":"^1.0.0","npm-run-all":"^3.1.1","pretty-bytes-cli":"^2.0.0","rollup":"^0.36.3","rollup-plugin-babel":"^2.6.1","rollup-plugin-es3":"^1.0.3","rollup-plugin-memory":"^2.0.0","sinon":"^1.17.6","uglify-js":"^2.7.3"},"gitHead":"6730ebbe17eb9e1488fd289731d6a9cbf75306a4","_id":"asyncro@2.0.0","_shasum":"cdd37776898a7a716cb9e741877650accfc68b80","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"developit","email":"jason@developit.ca"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"dist":{"shasum":"cdd37776898a7a716cb9e741877650accfc68b80","size":5880,"noattachment":false,"key":"/asyncro/-/asyncro-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/asyncro/download/asyncro-2.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/asyncro-2.0.0.tgz_1477194758991_0.1664136832114309"},"directories":{},"publish_time":1477194760996,"_cnpm_publish_time":1477194760996,"_hasShrinkwrap":false},"1.0.0":{"name":"asyncro","version":"1.0.0","description":"Utilities for working with Arrays asynchronously.","main":"lib/index.js","jsnext:main":"src/index.js","scripts":{"build":"babel src -d lib --minified --no-comments -s","prepublish":"npm run -s build && npm run -s test","test":"babel-node test","release":"npm run -s build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"repository":{"type":"git","url":"git+https://github.com/developit/asyncro.git"},"keywords":["async","await","arrays"],"author":{"name":"Jason Miller","email":"jason@developit.ca"},"license":"ISC","bugs":{"url":"https://github.com/developit/asyncro/issues"},"homepage":"https://github.com/developit/asyncro","devDependencies":{"babel-cli":"^6.14.0","babel-plugin-async-to-promises":"^1.0.5","babel-plugin-transform-react-jsx":"^6.8.0","babel-preset-es2015":"^6.14.0","babel-preset-stage-0":"^6.5.0"},"gitHead":"ffb97cdc96eb4f6e854bf40e3884b8df550f4109","_id":"asyncro@1.0.0","_shasum":"452ed48061f9ee6533ad4c3a0f9caa37d4ce5b71","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"developit","email":"jason@developit.ca"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"dist":{"shasum":"452ed48061f9ee6533ad4c3a0f9caa37d4ce5b71","size":3473,"noattachment":false,"key":"/asyncro/-/asyncro-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/asyncro/download/asyncro-1.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/asyncro-1.0.0.tgz_1477025202491_0.7236278441268951"},"directories":{},"publish_time":1477025203279,"_cnpm_publish_time":1477025203279,"_hasShrinkwrap":false}},"readme":"# `asyncro` [![NPM](https://img.shields.io/npm/v/asyncro.svg?style=flat)](https://www.npmjs.org/package/asyncro) [![travis-ci](https://travis-ci.org/developit/asyncro.svg?branch=master)](https://travis-ci.org/developit/asyncro)\n\nThe same `map()`, `reduce()` & `filter()` you know and love, but with async iterator functions!\n\nDo `fetch()` networking in loops, resolve Promises, anything async goes. Performance-friendly _by default_.\n\n**Here's what it looks like:**\n\n<img src=\"https://i.imgur.com/GcykVyN.png\" width=\"404\" alt=\"Asyncro Example\">\n\n* * *\n\n## What's in the Box\n\n<img src=\"https://i.imgur.com/yiiq6Gx.png\" width=\"275\" alt=\"Asyncro Example 2\">\n\n* * *\n\n## Installation\n\n```sh\nnpm install --save asyncro\n```\n\n## Import and Usage Example\n\n```js\nimport { map } from 'asyncro';\n\nasync function example() {\n\treturn await map(\n\t\t['foo', 'bar', 'baz'],\n\t\tasync name => fetch('./'+name)\n\t)\n}\n```\n\n## API\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n### reduce\n\nInvoke an async reducer function on each item in the given Array,\nwhere the reducer transforms an accumulator value based on each item iterated over.\n**Note:** because `reduce()` is order-sensitive, iteration is sequential.\n\n> This is an asynchronous version of `Array.prototype.reduce()`\n\n**Parameters**\n\n-   `array` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to reduce\n-   `reducer` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Async function, gets passed `(accumulator, value, index, array)` and returns a new value for `accumulator`\n-   `accumulator` **\\[any]** Optional initial accumulator value\n\n**Examples**\n\n```javascript\nawait reduce(\n\t['/foo', '/bar', '/baz'],\n\tasync (accumulator, value) => {\n\t\taccumulator[v] = await fetch(value);\n\t\treturn accumulator;\n\t},\n\t{}\n);\n```\n\nReturns **any** final `accumulator` value\n\n### map\n\nInvoke an async transform function on each item in the given Array **in parallel**,\nreturning the resulting Array of mapped/transformed items.\n\n> This is an asynchronous, parallelized version of `Array.prototype.map()`.\n\n**Parameters**\n\n-   `array` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to map over\n-   `mapper` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Async function, gets passed `(value, index, array)`, returns the new value.\n\n**Examples**\n\n```javascript\nawait map(\n\t['foo', 'baz'],\n\tasync v => await fetch(v)\n)\n```\n\nReturns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** resulting mapped/transformed values.\n\n### filter\n\nInvoke an async filter function on each item in the given Array **in parallel**,\nreturning an Array of values for which the filter function returned a truthy value.\n\n> This is an asynchronous, parallelized version of `Array.prototype.filter()`.\n\n**Parameters**\n\n-   `array` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to filter\n-   `filterer` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Async function. Gets passed `(value, index, array)`, returns true to keep the value in the resulting filtered Array.\n\n**Examples**\n\n```javascript\nawait filter(\n\t['foo', 'baz'],\n\tasync v => (await fetch(v)).ok\n)\n```\n\nReturns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** resulting filtered values\n\n### find\n\nInvoke an async function on each item in the given Array **in parallel**,\n returning the first element predicate returns truthy for.\n\n> This is an asynchronous, parallelized version of `Array.prototype.find()`.\n\n**Parameters**\n\n-   `array` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to find\n-   `predicate` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Async function. Gets passed `(value, index, array)`, returns true to be the find result.\n\n**Examples**\n\n```javascript\nawait find(\n\t['foo', 'baz', 'root'],\n\tasync v => (await fetch(v)).name === 'baz'\n)\n```\n\nReturns **any** resulting find value\n\n### every\n\nChecks if predicate returns truthy for **all** elements of collection **in parallel**.\n\n> This is an asynchronous, parallelized version of `Array.prototype.every()`.\n\n**Parameters**\n\n-   `array` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to iterate over.\n-   `predicate` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Async function. Gets passed `(value, index, array)`, The function invoked per iteration.\n\n**Examples**\n\n```javascript\nawait every(\n\t[2, 3],\n\tasync v => (await fetch(v)).ok\n)\n```\n\nReturns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns true if **all** element passes the predicate check, else false.\n\n### some\n\nChecks if predicate returns truthy for **any** element of collection **in parallel**.\n\n> This is an asynchronous, parallelized version of `Array.prototype.some()`.\n\n**Parameters**\n\n-   `array` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to iterate over.\n-   `filterer` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Async function. Gets passed `(value, index, array)`, The function invoked per iteration.\n\n**Examples**\n\n```javascript\nawait some(\n\t['foo', 'baz'],\n\tasync v => (await fetch(v)).ok\n)\n```\n\nReturns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns true if **any** element passes the predicate check, else false.\n\n### parallel\n\nInvoke all async functions in an Array or Object **in parallel**, returning the result.\n\n**Parameters**\n\n-   `list` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)> | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)&lt;[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)>)** Array/Object with values that are async functions to invoke.\n\n**Examples**\n\n```javascript\nawait parallel([\n\tasync () => await fetch('foo'),\n\tasync () => await fetch('baz')\n])\n```\n\nReturns **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** same structure as `list` input, but with values now resolved.\n\n### series\n\nInvoke all async functions in an Array or Object **sequentially**, returning the result.\n\n**Parameters**\n\n-   `list` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)> | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)&lt;[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)>)** Array/Object with values that are async functions to invoke.\n\n**Examples**\n\n```javascript\nawait series([\n\tasync () => await fetch('foo'),\n\tasync () => await fetch('baz')\n])\n```\n\nReturns **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** same structure as `list` input, but with values now resolved.\n\n## License\n\n[MIT](https://oss.ninja/mit/developit)\n","_attachments":{},"homepage":"https://github.com/developit/asyncro","bugs":{"url":"https://github.com/developit/asyncro/issues"},"license":"MIT"}