var ArrayToStream = require('array-to-stream')
var assert = require('assert')
var array = [1, false, {x: '10'}]
var emitted = []
var ended = false
new ArrayToStream(array)
.on('data', function (object) {
emitted.push(object)
})
.on('end', function () {
assert.deepEqual(emitted, array)
ended = true
})
process.on('exit', function () {
assert.equal(ended, true)
})
assert.throws(function () {
new ArrayToStream(['x', null, 'y'])
}, /Object streams cannot emit `null`/)
convert an array into an object stream
kemitchell/array-to-stream.js
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
convert an array into an object stream
Resources
Stars
Watchers
Forks
Packages 0
No packages published