{"id":13464863,"url":"https://github.com/sergioramos/apr","last_synced_at":"2026-04-05T17:36:42.206Z","repository":{"id":42354960,"uuid":"58504996","full_name":"sergioramos/apr","owner":"sergioramos","description":"this is like caolan/async which is like lodash but async, but awaitful","archived":false,"fork":false,"pushed_at":"2022-12-06T19:49:33.000Z","size":2544,"stargazers_count":74,"open_issues_count":67,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-29T13:18:28.831Z","etag":null,"topics":["async","async-await","async-programming","control-flow","es2015","javascript","promises"],"latest_commit_sha":null,"homepage":"https://apr.js.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sergioramos.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-11T01:34:38.000Z","updated_at":"2025-06-18T15:53:11.000Z","dependencies_parsed_at":"2023-01-23T15:00:11.884Z","dependency_job_id":null,"html_url":"https://github.com/sergioramos/apr","commit_stats":null,"previous_names":["ramitos/apr"],"tags_count":356,"template":false,"template_full_name":null,"purl":"pkg:github/sergioramos/apr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergioramos%2Fapr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergioramos%2Fapr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergioramos%2Fapr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergioramos%2Fapr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergioramos","download_url":"https://codeload.github.com/sergioramos/apr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergioramos%2Fapr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263079760,"owners_count":23410530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","async-await","async-programming","control-flow","es2015","javascript","promises"],"created_at":"2024-07-31T14:00:51.831Z","updated_at":"2026-04-05T17:36:37.182Z","avatar_url":"https://github.com/sergioramos.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n## apr\n\n[![Travis](https://img.shields.io/travis/ramitos/apr.svg?style=flat-square)](https://travis-ci.org/ramitos/apr) [![](https://img.shields.io/codeclimate/coverage/github/ramitos/apr.svg?style=flat-square)](https://codeclimate.com/github/ramitos/apr/coverage)\n\nCollection of tools to manage control flow of/with Promises - inspired by [caolan/async](https://github.com/caolan/async).\n\nWorks with and without async/await. The lib itself only uses promises.\n\nAs someone beautifully put it:\n\n\u003e this is like [caolan/async](https://github.com/caolan/async) which is like [lodash](https://github.com/lodash/lodash) but async, but awaitful\n\n\n\u003ca id=\"contents\"\u003e\u003c/a\u003e\n## contents\n\n\n* [Collections](#collections)\n  * [concat](#concat)\n  * [every](#every)\n  * [filter](#filter)\n  * [find](#find)\n  * [for-each](#for-each)\n  * [map](#map)\n  * [reduce](#reduce)\n  * [reject](#reject)\n  * [some](#some)\n  * [sort-by](#sort-by)\n    \n* [Control Flow](#control-flow)\n  * [compose](#compose)\n  * [parallel](#parallel)\n  * [seq](#seq)\n  * [series](#series)\n  * [until](#until)\n  * [waterfall](#waterfall)\n  * [whilst](#whilst)\n    \n* [Utilities](#utilities)\n  * [apply](#apply)\n  * [asyncify](#asyncify)\n  * [awaitify](#awaitify)\n  * [constant](#constant)\n  * [intercept](#intercept)\n  * [reflect](#reflect)\n  * [times](#times)\n  * [main](#main)\n    \n* [credits](#credits)\n  \n    \n* [license](#license)\n  \n    \n\n\n## Collections\n\nFunctions for manipulating collections, such as arrays and objects.\n\n\n## concat\n\n[packages/concat/index.js:30-35](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/concat/index.js#L30-L35 \"Source code on GitHub\")\n\n\u003ca id=\"concat\"\u003e\u003c/a\u003e\nApplies `iteratee` to each item in `coll`, concatenating the results. Returns the concatenated list.\n\n[![](https://img.shields.io/npm/v/apr-concat.svg?style=flat-square)](https://www.npmjs.com/package/apr-concat) [![](https://img.shields.io/npm/l/apr-concat.svg?style=flat-square)](https://www.npmjs.com/package/apr-concat)\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport awaitify from 'apr-awaitify';\nimport concat from 'apr-concat';\n\nconst readdir = awaitify(fs.readdir);\nconst dirs = [\n  'dir1',\n  'dir2',\n  'dir3'\n];\n\nconst files = await concat(dirs, async (dir) =\u003e\n  await readdir(dir)\n);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### series\n\n[packages/concat/series.js:11-11](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/concat/series.js#L11-L11 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### limit\n\n[packages/concat/limit.js:13-23](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/concat/limit.js#L13-L23 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## every\n\n[packages/every/index.js:30-35](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/every/index.js#L30-L35 \"Source code on GitHub\")\n\n\u003ca id=\"every\"\u003e\u003c/a\u003e\nReturns true if every element in `coll` satisfies an async test.\n\n[![](https://img.shields.io/npm/v/apr-every.svg?style=flat-square)](https://www.npmjs.com/package/apr-every) [![](https://img.shields.io/npm/l/apr-every.svg?style=flat-square)](https://www.npmjs.com/package/apr-every)\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport awaitify from 'apr-awaitify';\nimport every from 'apr-every';\n\nconst access = awaitify(fs.access);\nconst files = [\n  'file1',\n  'file2',\n  'file3'\n];\n\nconst allExist = await every(files, async (file) =\u003e\n  await access(file)\n);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### series\n\n[packages/every/series.js:11-11](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/every/series.js#L11-L11 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### limit\n\n[packages/every/limit.js:14-24](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/every/limit.js#L14-L24 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## filter\n\n[packages/filter/index.js:31-31](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/filter/index.js#L31-L31 \"Source code on GitHub\")\n\n\u003ca id=\"filter\"\u003e\u003c/a\u003e\nReturns a new array of all the values in `coll` which pass an async truth test.\n\n[![](https://img.shields.io/npm/v/apr-filter.svg?style=flat-square)](https://www.npmjs.com/package/apr-filter) [![](https://img.shields.io/npm/l/apr-filter.svg?style=flat-square)](https://www.npmjs.com/package/apr-filter)\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport awaitify from 'apr-awaitify';\nimport filter from 'apr-filter';\n\nconst access = awaitify(fs.access);\nconst files = [\n  'file1',\n  'file2',\n  'file3'\n];\n\nvar existent = await filter(files, async (file) =\u003e\n  await access(file)\n);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### series\n\n[packages/filter/series.js:11-11](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/filter/series.js#L11-L11 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### limit\n\n[packages/filter/limit.js:13-14](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/filter/limit.js#L13-L14 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## find\n\n[packages/find/index.js:30-35](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/find/index.js#L30-L35 \"Source code on GitHub\")\n\n\u003ca id=\"find\"\u003e\u003c/a\u003e\nReturns the first value in `coll` that passes an async truth test.\n\n[![](https://img.shields.io/npm/v/apr-find.svg?style=flat-square)](https://www.npmjs.com/package/apr-find) [![](https://img.shields.io/npm/l/apr-find.svg?style=flat-square)](https://www.npmjs.com/package/apr-find)\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport awaitify from 'apr-awaitify';\nimport find from 'apr-find';\n\nconst access = awaitify(fs.access);\nconst files = [\n  'file1',\n  'file2',\n  'file3'\n];\n\nconst first = await find(files, async (file) =\u003e\n  await access(file)\n);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### series\n\n[packages/find/series.js:11-11](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/find/series.js#L11-L11 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### limit\n\n[packages/find/limit.js:13-23](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/find/limit.js#L13-L23 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## for-each\n\n[packages/for-each/index.js:29-34](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/for-each/index.js#L29-L34 \"Source code on GitHub\")\n\n\u003ca id=\"for-each\"\u003e\u003c/a\u003e\nApplies the function `iteratee` to each item in `coll`, in parallel.\n\n[![](https://img.shields.io/npm/v/apr-for-each.svg?style=flat-square)](https://www.npmjs.com/package/apr-for-each) [![](https://img.shields.io/npm/l/apr-for-each.svg?style=flat-square)](https://www.npmjs.com/package/apr-for-each)\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport awaitify from 'apr-awaitify';\nimport forEach from 'apr-for-each';\n\nconst writeFile = awaitify(fs.writeFile);\nconst files = [\n  '/home/.vimrc',\n  '/home/.zshrc'\n];\n\nawait forEach(files, async (file) =\u003e\n  await writeFile(file, 'boom')\n);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### series\n\n[packages/for-each/series.js:11-11](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/for-each/series.js#L11-L11 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### limit\n\n[packages/for-each/limit.js:13-23](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/for-each/limit.js#L13-L23 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## map\n\n[packages/map/index.js:30-35](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/map/index.js#L30-L35 \"Source code on GitHub\")\n\n\u003ca id=\"map\"\u003e\u003c/a\u003e\nProduces a new collection of values by mapping each value in `coll` through the `iteratee` function.\n\n[![](https://img.shields.io/npm/v/apr-map.svg?style=flat-square)](https://www.npmjs.com/package/apr-map) [![](https://img.shields.io/npm/l/apr-map.svg?style=flat-square)](https://www.npmjs.com/package/apr-map)\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport awaitify from 'apr-awaitify';\nimport map from 'apr-map';\n\nconst stat = awaitify(fs.stat);\nconst files = [\n  'file1',\n  'file2',\n  'file3'\n];\n\nconst stats = await map(files, async (file) =\u003e\n  await stat(file);\n);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### series\n\n[packages/map/series.js:11-11](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/map/series.js#L11-L11 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### limit\n\n[packages/map/limit.js:13-23](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/map/limit.js#L13-L23 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## reduce\n\n[packages/reduce/index.js:23-33](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/reduce/index.js#L23-L33 \"Source code on GitHub\")\n\n\u003ca id=\"reduce\"\u003e\u003c/a\u003e\nReduces `coll` into a single value using an async `iteratee` to return each successive step.\n\n[![](https://img.shields.io/npm/v/apr-reduce.svg?style=flat-square)](https://www.npmjs.com/package/apr-reduce) [![](https://img.shields.io/npm/l/apr-reduce.svg?style=flat-square)](https://www.npmjs.com/package/apr-reduce)\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport reduce from 'apr-reduce';\n\nconst sum = await reduce([1, 2, 3], async (sum, item) =\u003e\n  new Promise((resolve) =\u003e resolve(sum + item))\n);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## reject\n\n[packages/reject/index.js:31-31](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/reject/index.js#L31-L31 \"Source code on GitHub\")\n\n\u003ca id=\"reject\"\u003e\u003c/a\u003e\nThe opposite of [`filter`](#filter). Removes values that pass an async truth test.\n\n[![](https://img.shields.io/npm/v/apr-reject.svg?style=flat-square)](https://www.npmjs.com/package/apr-reject) [![](https://img.shields.io/npm/l/apr-reject.svg?style=flat-square)](https://www.npmjs.com/package/apr-reject)\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport awaitify from 'apr-awaitify';\nimport reject from 'apr-reject';\n\nconst access = awaitify(fs.access);\nconst files = [\n  'file1',\n  'file2',\n  'file3'\n];\n\nvar missing = await reject(files, async (file) =\u003e\n  await access(file)\n);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### series\n\n[packages/reject/series.js:11-11](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/reject/series.js#L11-L11 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### limit\n\n[packages/reject/limit.js:13-14](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/reject/limit.js#L13-L14 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## some\n\n[packages/some/index.js:31-31](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/some/index.js#L31-L31 \"Source code on GitHub\")\n\n\u003ca id=\"some\"\u003e\u003c/a\u003e\nReturns true if at least one element in the `coll` satisfies an async test.\n\n[![](https://img.shields.io/npm/v/apr-some.svg?style=flat-square)](https://www.npmjs.com/package/apr-some) [![](https://img.shields.io/npm/l/apr-some.svg?style=flat-square)](https://www.npmjs.com/package/apr-some)\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport awaitify from 'apr-awaitify';\nimport some from 'apr-some';\n\nconst access = awaitify(fs.access);\nconst files = [\n  'file1',\n  'file2',\n  'file3'\n];\n\nconst oneExist = await some(files, async (file) =\u003e\n  await access(file)\n);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### series\n\n[packages/some/series.js:11-11](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/some/series.js#L11-L11 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### series\n\n[packages/sort-by/series.js:11-11](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/sort-by/series.js#L11-L11 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### limit\n\n[packages/some/limit.js:13-13](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/some/limit.js#L13-L13 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## sort-by\n\n[packages/sort-by/index.js:32-32](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/sort-by/index.js#L32-L32 \"Source code on GitHub\")\n\n\u003ca id=\"sort-by\"\u003e\u003c/a\u003e\nSorts a list by the results of running each `coll` value through an async `iteratee`.\n\n[![](https://img.shields.io/npm/v/apr-sort-by.svg?style=flat-square)](https://www.npmjs.com/package/apr-sort-by) [![](https://img.shields.io/npm/l/apr-sort-by.svg?style=flat-square)](https://www.npmjs.com/package/apr-sort-by)\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport awaitify from 'apr-awaitify';\nimport sortBy from 'apr-sort-by';\n\nconst stat = awaitify(fs.stat);\nconst files = [\n  'file1',\n  'file2',\n  'file3'\n];\n\nconst sorted = await sortBy(files, await (file) =\u003e {\n  const { mtime } = await stat(file);\n  return mtime;\n});\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### limit\n\n[packages/sort-by/limit.js:13-14](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/sort-by/limit.js#L13-L14 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** \n-   `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## Control Flow\n\nA collection of async functions for controlling the flow through a script.\n\n\n## compose\n\n[packages/compose/index.js:28-31](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/compose/index.js#L28-L31 \"Source code on GitHub\")\n\n\u003ca id=\"sompose\"\u003e\u003c/a\u003e\nCreates a function which is a composition of the passed asynchronous functions. Each function consumes the return value of the function that follows. Composing functions f(), g(), and h() would produce the result of f(g(h())).\n\n[![](https://img.shields.io/npm/v/apr-compose.svg?style=flat-square)](https://www.npmjs.com/package/apr-compose) [![](https://img.shields.io/npm/l/apr-compose.svg?style=flat-square)](https://www.npmjs.com/package/apr-compose)\n\n**Parameters**\n\n-   `function` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport compose from 'apr-compose';\n\nconst then = (v) =\u003e new Promise((resolve) =\u003e resolve(v));\n\nconst composed = compose(\n  async (v) =\u003e await then(v + 1),\n  async (v) =\u003e await then(v + 2),\n  async (v) =\u003e await then(v + 3)\n);\n\nconst output = await composed(1); // 7\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n## parallel\n\n[packages/parallel/index.js:34-46](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/parallel/index.js#L34-L46 \"Source code on GitHub\")\n\n\u003ca id=\"parallel\"\u003e\u003c/a\u003e\nRun the tasks collection of functions in parallel, without waiting until the previous function has completed.\n\n[![](https://img.shields.io/npm/v/apr-parallel.svg?style=flat-square)](https://www.npmjs.com/package/apr-parallel) [![](https://img.shields.io/npm/l/apr-parallel.svg?style=flat-square)](https://www.npmjs.com/package/apr-parallel)\n\n**Parameters**\n\n-   `tasks` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\u003e | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** \n\n**Examples**\n\n```javascript\nimport parallel from 'apr-parallel';\n\nconst then = (v) =\u003e new Promise((resolve) =\u003e resolve(v));\n\nconst withArray = await parallel([\n  async () =\u003e await then(1),\n  async () =\u003e await then(2)\n]);\n\n// withArray = [1, 2]\n\nconst withObject = await parallel({\n  one: async () =\u003e await then(1),\n  two: async () =\u003e await then(2)\n});\n\n// withObject = { one: 1, two: 2 }\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## seq\n\n[packages/seq/index.js:27-27](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/seq/index.js#L27-L27 \"Source code on GitHub\")\n\n\u003ca id=\"seq\"\u003e\u003c/a\u003e\nVersion of the compose function that is more natural to read. Each function consumes the return value of the previous function. It is the equivalent of compose with the arguments reversed.\n\n[![](https://img.shields.io/npm/v/apr-seq.svg?style=flat-square)](https://www.npmjs.com/package/apr-seq) [![](https://img.shields.io/npm/l/apr-seq.svg?style=flat-square)](https://www.npmjs.com/package/apr-seq)\n\n**Parameters**\n\n-   `tasks` **...[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport seq from 'apr-seq';\n\nconst then = (v) =\u003e new Promise((resolve) =\u003e resolve(v));\n\nconst seq = seq(\n  async (v) =\u003e await then(v + 1),\n  async (v) =\u003e await then(v + 2),\n  async (v) =\u003e await then(v + 3)\n);\n\nconst output = await seq(1); // 7\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n## series\n\n[packages/series/index.js:34-46](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/series/index.js#L34-L46 \"Source code on GitHub\")\n\n\u003ca id=\"series\"\u003e\u003c/a\u003e\nRun the functions in the `tasks` in series, each one running once the previous function has completed.\n\n[![](https://img.shields.io/npm/v/apr-series.svg?style=flat-square)](https://www.npmjs.com/package/apr-series) [![](https://img.shields.io/npm/l/apr-series.svg?style=flat-square)](https://www.npmjs.com/package/apr-series)\n\n**Parameters**\n\n-   `tasks` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)\u003e | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** \n\n**Examples**\n\n```javascript\nimport series from 'apr-series';\n\nconst then = (v) =\u003e new Promise((resolve) =\u003e resolve(v));\n\nconst withArray = await series([\n  async () =\u003e await then(1),\n  async () =\u003e await then(2)\n]);\n\n// withArray = [1, 2]\n\nconst withObject = await series({\n  one: async () =\u003e await then(1),\n  two: async () =\u003e await then(2)\n});\n\n// withObject = { one: 1, two: 2 }\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## until\n\n[packages/until/index.js:33-38](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/until/index.js#L33-L38 \"Source code on GitHub\")\n\n\u003ca id=\"until\"\u003e\u003c/a\u003e\nRepeatedly call `fn` until `test` returns `true`.\n\n[![](https://img.shields.io/npm/v/apr-until.svg?style=flat-square)](https://www.npmjs.com/package/apr-until) [![](https://img.shields.io/npm/l/apr-until.svg?style=flat-square)](https://www.npmjs.com/package/apr-until)\n\n**Parameters**\n\n-   `test` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `fn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport until from 'apr-until';\n\nconst then = (v) =\u003e new Promise((resolve) =\u003e resolve(v));\n\nconst maxCalls = 10;\nlet calls = 0;\n\n\nconst output = await until(async () =\u003e {\n  await then();\n  return (calls += 1) \u003e= maxCalls;\n}, async () =\u003e (\n  await then(calls)\n);\n\n// output = 10\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## waterfall\n\n[packages/waterfall/index.js:28-41](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/waterfall/index.js#L28-L41 \"Source code on GitHub\")\n\n\u003ca id=\"waterfall\"\u003e\u003c/a\u003e\nRuns the `tasks` array of functions in series, each passing their results to the next in the array.\n\n[![](https://img.shields.io/npm/v/apr-waterfall.svg?style=flat-square)](https://www.npmjs.com/package/apr-waterfall) [![](https://img.shields.io/npm/l/apr-waterfall.svg?style=flat-square)](https://www.npmjs.com/package/apr-waterfall)\n\n**Parameters**\n\n-   `tasks` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)\u003e | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** \n-   `initial` **Any?** \n\n**Examples**\n\n```javascript\nimport waterfall from 'apr-waterfall';\n\nconst then = (v) =\u003e new Promise((resolve) =\u003e resolve(v));\n\nconst output = await waterfall([\n  async () =\u003e await then(1),\n  async (v) =\u003e await then(v + 2),\n  async (v) =\u003e await then(v + 3)\n]);\n\n// output = 6\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## whilst\n\n[packages/whilst/index.js:32-37](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/whilst/index.js#L32-L37 \"Source code on GitHub\")\n\n\u003ca id=\"whilst\"\u003e\u003c/a\u003e\nRepeatedly call `fn`, while `test` returns true.\n\n[![](https://img.shields.io/npm/v/apr-whilst.svg?style=flat-square)](https://www.npmjs.com/package/apr-whilst) [![](https://img.shields.io/npm/l/apr-whilst.svg?style=flat-square)](https://www.npmjs.com/package/apr-whilst)\n\n**Parameters**\n\n-   `test` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `fn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport whilst from 'apr-whilst';\n\nconst then = (v) =\u003e new Promise((resolve) =\u003e resolve(v));\n\nconst maxCalls = 10;\nlet calls = 0;\n\nconst output = await whilst(async () =\u003e {\n  await then();\n  return (calls += 1) \u003c maxCalls;\n}, async () =\u003e (\n  await then(calls)\n);\n\n// output = 10\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## Utilities\n\nA collection of awaitable utility functions.\n\n\n## apply\n\n[packages/apply/index.js:27-27](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/apply/index.js#L27-L27 \"Source code on GitHub\")\n\n\u003ca id=\"apply\"\u003e\u003c/a\u003e\nCreates a continuation function with some arguments already applied.\n\n[![](https://img.shields.io/npm/v/apr-apply.svg?style=flat-square)](https://www.npmjs.com/package/apr-apply) [![](https://img.shields.io/npm/l/apr-apply.svg?style=flat-square)](https://www.npmjs.com/package/apr-apply)\n\n**Parameters**\n\n-   `function` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `arguments` **...Any** \n\n**Examples**\n\n```javascript\nimport parallel from 'apr-parallel';\nimport apply from 'apr-apply';\n\nconst then = (v) =\u003e new Promise((resolve) =\u003e resolve(v));\n\nconst output = await parallel([\n  apply(then, 1)\n  apply(then, 2)\n  apply(then, 3)\n]);\n\n// output = [1, 2, 3]\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n## asyncify\n\n[packages/asyncify/index.js:26-33](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/asyncify/index.js#L26-L33 \"Source code on GitHub\")\n\n\u003ca id=\"asyncify\"\u003e\u003c/a\u003e\nTake a sync function and make it async. This is useful for plugging sync functions into a [`waterfall`](#waterfall), [`series`](#series), or other async functions.\n\n[![](https://img.shields.io/npm/v/apr-asyncify.svg?style=flat-square)](https://www.npmjs.com/package/apr-asyncify) [![](https://img.shields.io/npm/l/apr-asyncify.svg?style=flat-square)](https://www.npmjs.com/package/apr-asyncify)\n\n**Parameters**\n\n-   `function` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport awaitify from 'apr-awaitify';\nimport asyncify from 'apr-asyncify';\nimport waterfall from 'apr-waterfall';\nimport apply from 'apr-apply';\n\nconst readFile = awaitify(require('fs').readFile);\nconst pkgPath = path.join(__dirname, './package.json');\n\nconst pkg = await waterfall([\n  apply(readFile, pkgPath, 'utf8'),\n  asyncify(JSON.parse)\n]);\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n## awaitify\n\n[packages/awaitify/index.js:22-25](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/awaitify/index.js#L22-L25 \"Source code on GitHub\")\n\n\u003ca id=\"awaitify\"\u003e\u003c/a\u003e\nTransform a callback-based function into a promise-based one.\n\n[![](https://img.shields.io/npm/v/apr-awaitify.svg?style=flat-square)](https://www.npmjs.com/package/apr-awaitify) [![](https://img.shields.io/npm/l/apr-awaitify.svg?style=flat-square)](https://www.npmjs.com/package/apr-awaitify)\n\n**Parameters**\n\n-   `function` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport { readFile as readFileCb } from 'fs';\nimport awaitify from 'apr-awaitify';\nimport path from 'path';\n\nconst readFile = awaitify(readFileCb);\nconst pkgPath = path.join(__dirname, './package.json');\n\nconst pkg = await readFile(pkgPath, 'utf-8');\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n## constant\n\n[packages/constant/index.js:22-22](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/constant/index.js#L22-L22 \"Source code on GitHub\")\n\n\u003ca id=\"constant\"\u003e\u003c/a\u003e\nReturns a promise that when called, then's with the values provided. Useful as the first function in a [`waterfall`](#waterfall).\n\n[![](https://img.shields.io/npm/v/apr-constant.svg?style=flat-square)](https://www.npmjs.com/package/apr-constant) [![](https://img.shields.io/npm/l/apr-constant.svg?style=flat-square)](https://www.npmjs.com/package/apr-constant)\n\n**Parameters**\n\n-   `arguments` **...any** \n\n**Examples**\n\n```javascript\nimport asyncify from 'apr-asyncify';\nimport waterfall from 'apr-waterfall';\nimport constant from 'apr-constant';\n\nconst pkg = await waterfall([\n  constant('{\"name\": \"apr\"}'),\n  asyncify(JSON.parse)\n]);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## intercept\n\n[packages/intercept/index.js:19-25](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/intercept/index.js#L19-L25 \"Source code on GitHub\")\n\n\u003ca id=\"intercept\"\u003e\u003c/a\u003e\nIntercepts errors, the Go way!\n\n[![](https://img.shields.io/npm/v/apr-intercept.svg?style=flat-square)](https://www.npmjs.com/package/apr-intercept) [![](https://img.shields.io/npm/l/apr-intercept.svg?style=flat-square)](https://www.npmjs.com/package/apr-intercept)\n\n**Parameters**\n\n-   `input` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n**Examples**\n\n```javascript\nimport ctch from 'apr-intercept';\n\nconst [err1, res1] = await ctch(fn(1));\nconst [err2, res2] = await ctch(fn(1));\nconst [, res3] = await ctch(fn(3));\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## reflect\n\n[packages/reflect/index.js:28-37](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/reflect/index.js#L28-L37 \"Source code on GitHub\")\n\n\u003ca id=\"reflect\"\u003e\u003c/a\u003e\nWraps the function in another function that always returns data even when it errors.\nThe object returned has either the property error or value.\n\n[![](https://img.shields.io/npm/v/apr-reflect.svg?style=flat-square)](https://www.npmjs.com/package/apr-reflect) [![](https://img.shields.io/npm/l/apr-reflect.svg?style=flat-square)](https://www.npmjs.com/package/apr-reflect)\n\n**Parameters**\n\n-   `input` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport parallel from 'apr-parallel';\nimport reflect from 'apr-reflect';\n\nconst then = (v) =\u003e new Promise((resolve) =\u003e resolve(v));\n\nconst res = await parallel([\n  async () =\u003e {\n    throw new Error('heyo')\n  },\n  async () =\u003e await then(2)\n]);\n\n// res = [{ error: Error('heyo'), value: null }, { error: null, value: 2 }]\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n## times\n\n[packages/times/index.js:24-24](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/times/index.js#L24-L24 \"Source code on GitHub\")\n\n\u003ca id=\"times\"\u003e\u003c/a\u003e\nCalls the `iteratee` function `n` times, and accumulates results in the same manner you would use with [map](#map).\n\n[![](https://img.shields.io/npm/v/apr-times.svg?style=flat-square)](https://www.npmjs.com/package/apr-times) [![](https://img.shields.io/npm/l/apr-times.svg?style=flat-square)](https://www.npmjs.com/package/apr-times)\n\n**Parameters**\n\n-   `n` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nimport times from 'apr-times';\n\nconst then = (v) =\u003e new Promise((resolve) =\u003e resolve(v));\n\nconst res = await times(6, async (i) =\u003e\n  await then(i);\n);\n\n// res = [0, 1, 2, 3, 4, 5]\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### series\n\n[packages/times/series.js:11-11](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/times/series.js#L11-L11 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `n` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n### limit\n\n[packages/times/limit.js:13-23](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/times/limit.js#L13-L23 \"Source code on GitHub\")\n\n**Parameters**\n\n-   `n` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n-   `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## main\n\n[packages/main/index.js:27-27](https://github.com/ramitos/apr/blob/f07fd61f41a1053a0efb60ed54f393b83b73a7f5/packages/main/index.js#L27-L27 \"Source code on GitHub\")\n\n\u003ca id=\"main\"\u003e\u003c/a\u003e\nCatches a promise error, writes the stacktrace to stderr and exists\n\n[![](https://img.shields.io/npm/v/apr-main.svg?style=flat-square)](https://www.npmjs.com/package/apr-main) [![](https://img.shields.io/npm/l/apr-main.svg?style=flat-square)](https://www.npmjs.com/package/apr-main)\n\n**Parameters**\n\n-   `input` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n**Examples**\n\n```javascript\nimport main from 'apr-main';\n\nmain(async () =\u003e 'hello') // writes nothing\nmain(async () =\u003e undefined) // writes nothing\nmain(async () =\u003e { throw new Error('uncaught error') }) // writes the stack trace to stderr and exists\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n## credits\n\n-   both the method signatures and descriptions are copied from [caolan/async](https://github.com/caolan/async/blob/master/LICENSE)\n\n\n## license\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergioramos%2Fapr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergioramos%2Fapr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergioramos%2Fapr/lists"}