https://github.com/awinterman/new-from
modernized [from](https://github.com/dominictarr/from)
https://github.com/awinterman/new-from
Last synced: over 1 year ago
JSON representation
modernized [from](https://github.com/dominictarr/from)
- Host: GitHub
- URL: https://github.com/awinterman/new-from
- Owner: AWinterman
- Created: 2013-09-08T00:02:17.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2020-02-20T20:44:29.000Z (over 6 years ago)
- Last Synced: 2025-03-16T20:36:01.995Z (over 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.markdown
Awesome Lists containing this project
README
# new-from
A modern version of dominictarr's from, implemented with the new stream api.
# Deprecation notice
There are other modules that accomplish the same or similar goals.
- from2 - pretty much identical.
- into-stream - similar goals.
Also, the readable-stream constructors are much easier to use now.
## API:
```javascript
var from = require('new-from')
var zero_to_nine = from(make_chunk)
function make_chunk(idx) {
if(idx < 10) {
return idx
}
return null
}
// Or, in this case:
zero_to_nine = from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
```