Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/p-pipe
Compose promise-returning & async functions into a reusable pipeline
https://github.com/sindresorhus/p-pipe
Last synced: 8 days ago
JSON representation
Compose promise-returning & async functions into a reusable pipeline
- Host: GitHub
- URL: https://github.com/sindresorhus/p-pipe
- Owner: sindresorhus
- License: mit
- Created: 2016-10-21T05:01:39.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2021-04-08T14:00:29.000Z (over 3 years ago)
- Last Synced: 2024-10-29T22:38:30.100Z (10 days ago)
- Language: TypeScript
- Size: 22.5 KB
- Stars: 122
- Watchers: 6
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
- Security: .github/security.md
Awesome Lists containing this project
- promise-fun - p-pipe - returning & async functions into a reusable pipeline (Packages)
README
# p-pipe
> Compose promise-returning & async functions into a reusable pipeline
## Install
```
$ npm install p-pipe
```## Usage
```js
import pPipe from 'p-pipe';const addUnicorn = async string => `${string} Unicorn`;
const addRainbow = async string => `${string} Rainbow`;const pipeline = pPipe(addUnicorn, addRainbow);
console.log(await pipeline('❤️'));
//=> '❤️ Unicorn Rainbow'
```## API
### pPipe(input…)
The `input` functions are applied from left to right.
#### input
Type: `Function`
Expected to return a `Promise` or any value.
## Related
- [p-each-series](https://github.com/sindresorhus/p-each-series) - Iterate over promises serially
- [p-series](https://github.com/sindresorhus/p-series) - Run promise-returning & async functions in series
- [p-waterfall](https://github.com/sindresorhus/p-waterfall) - Run promise-returning & async functions in series, each passing its result to the next
- [More…](https://github.com/sindresorhus/promise-fun)---
Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.