https://github.com/featurist/promise-builder
Builds up promises step by step
https://github.com/featurist/promise-builder
Last synced: about 2 months ago
JSON representation
Builds up promises step by step
- Host: GitHub
- URL: https://github.com/featurist/promise-builder
- Owner: featurist
- Created: 2016-07-24T14:44:34.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-06T17:39:32.000Z (over 8 years ago)
- Last Synced: 2025-01-20T11:21:39.626Z (3 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# promise-builder
Builds up promises step by step.
# example
```JavaScript
var builder = require('promise-builder')(
{
zero: () => 0,
add: (x, p) => Promise.resolve(p + x),
minus: (x, p) => p - x
}
);builder.zero().add(1).add(3).then(n => n * 2).minus(1).then(console.log);
// -> Logs '7'
```