https://github.com/dimfeld/pull-map-async-done
Asynchronous map with done/flush callback for pull streams
https://github.com/dimfeld/pull-map-async-done
Last synced: over 1 year ago
JSON representation
Asynchronous map with done/flush callback for pull streams
- Host: GitHub
- URL: https://github.com/dimfeld/pull-map-async-done
- Owner: dimfeld
- License: mit
- Created: 2018-06-21T20:20:50.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-22T21:22:13.000Z (about 8 years ago)
- Last Synced: 2025-03-13T05:15:38.019Z (over 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pull-map-async-map-done
This is based on the async-map through stream from the core pull-stream module, with the addition of a done callback that can optionally pass on a final value.
```
var asyncMap = require('pull-async-map-done');
asyncMap(
function map(data, cb) {
cb(null, `Value: ${data}`);
},
function done(err, cb) {
if(err) console.log("Error!");
cb(null, "Done"); // or cb(null) to not pass through a final piece of data
}
)
```