Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asyncpipe

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asyncpipe - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

.eslintrc.yml

27

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc