Comparing version 0.1.0 to 1.0.0
{ | ||
"name": "asyncpipe", | ||
"version": "0.1.0", | ||
"description": "Functional composition library for asynchronous functions", | ||
"main": "dist", | ||
"version": "1.0.0", | ||
"description": "Compose asynchronous functions", | ||
"main": "lib", | ||
"scripts": { | ||
"prebuild": "npm run lint", | ||
"build": "babel src --out-dir dist --copy-files --source-maps inline", | ||
"lint": "eslint --fix src", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"lint": "npm run lint-ci -- --fix", | ||
"lint-ci": "eslint --format=table .", | ||
"test": "node test" | ||
}, | ||
"precommit": "build", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://hifaraz@github.com/HiFaraz/asyncpipe.git" | ||
"url": "git+https://github.com/HiFaraz/asyncpipe.git" | ||
}, | ||
@@ -33,8 +31,7 @@ "keywords": [ | ||
"devDependencies": { | ||
"babel-cli": "^6.22.2", | ||
"babel-polyfill": "^6.22.0", | ||
"babel-preset-latest": "^6.22.0", | ||
"eslint": "^3.13.1", | ||
"pre-commit": "^1.2.2" | ||
"eslint": "^4.11.0", | ||
"eslint-config-prettier": "^2.8.0", | ||
"eslint-plugin-prettier": "^2.3.1", | ||
"prettier": "^1.8.2" | ||
} | ||
} | ||
} |
# asyncpipe | ||
Functional composition library for asynchronous functions in JavaScript | ||
Like lodash.flow, but for Promises! | ||
Compose asynchronous functions in JavaScript | ||
[![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] | ||
[![Maintainability][maintainability-image]][maintainability-url] | ||
`asyncpipe` composes asynchronous functions, a perfect fit for functional | ||
programming with Promises or `async`/`await`. It was inspired by `lodash.flow`, | ||
which is excellent but does not support functions that return Promises. | ||
# Is this production ready? | ||
Yes. This module: | ||
* [is small](lib/index.js) | ||
* [is tested with continuous integration](test) | ||
* [works on Node.js v4+](.travis.yml) | ||
* does not need to be built/transpiled | ||
* [does not have any production dependencies](package.json) | ||
## Installation | ||
`$ npm install --save asyncpipe` | ||
This is a [Node.js](https://nodejs.org/en/) module available through the | ||
[npm registry](https://www.npmjs.com/). Installation is done using the | ||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): | ||
```sh | ||
$ npm install asyncpipe | ||
``` | ||
## API | ||
```js | ||
var asyncpipe = require('asyncpipe'); | ||
``` | ||
### asyncpipe(func1, func2, ...) | ||
Compose an asynchronous function from the series of input arguments (`func1`, | ||
`func2`, ...). | ||
Any error thrown within the series of async functions will be thrown by the | ||
composed function. | ||
## Example | ||
```js | ||
import 'asyncpipe'; | ||
const asyncpipe = require('asyncpipe'); | ||
(async() => { | ||
(async () => { | ||
const a = x => x + 1; | ||
const b = x => Promise.resolve(x * 2); | ||
const c = async x => { | ||
await ExternalService.store(x); | ||
await someExternalService(x); | ||
return x; | ||
}; | ||
const result = await asyncpipe( | ||
a, | ||
b, | ||
c, | ||
)(99); | ||
const result = await asyncpipe(a, b, c)(99); | ||
console.log(result); // PRINTS: 200 | ||
})(); | ||
``` | ||
``` | ||
[npm-image]: https://img.shields.io/npm/v/asyncpipe.svg | ||
[npm-url]: https://npmjs.org/package/asyncpipe | ||
[travis-image]: https://travis-ci.org/HiFaraz/asyncpipe.svg?branch=master | ||
[travis-url]: https://travis-ci.org/HiFaraz/asyncpipe | ||
[maintainability-image]: https://api.codeclimate.com/v1/badges/c7e61e4de474c6b264dc/maintainability | ||
[maintainability-url]: https://codeclimate.com/github/HiFaraz/asyncpipe/maintainability |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4
0
70
7261
8
59
1