Through stream which removes all non-numeric values from a stream.
$ npm install flow-nans
var eventStream = require( 'event-stream' ),
fStream = require( 'flow-nans' );
var data = new Array( 9 );
// Create some data...
data[ 0 ] = 'a';
data[ 1 ] = true;
data[ 2 ] = function(){};
data[ 3 ] = {};
data[ 4 ] = [];
data[ 5 ] = undefined;
data[ 6 ] = NaN;
data[ 7 ] = null;
data[ 8 ] = 0;
// Create a readable stream:
var readStream = eventStream.readArray( data );
// Create a new NaN filter stream:
var stream = fStream()
.accessors( 'd', function ( d ) {
return d;
})
.stream();
// Create the pipeline:
readStream.pipe( stream )
.pipe( eventStream.stringify() )
.pipe( process.stdout );
Unit tests use the Mocha test framework with Chai assertions.
Assuming you have installed Mocha, execute the following command in the top-level application directory to run the tests:
$ mocha
All new feature development should have corresponding unit tests to validate correct functionality.
Copyright © 2014. Athan Reines.