0.0.2 • Published 10 years ago

flow-nans v0.0.2

Weekly downloads
3
License
-
Repository
github
Last release
10 years ago

flow-nans

Through stream which removes all non-numeric values from a stream.

Installation

$ npm install flow-nans

Examples

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 );

Tests

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.

License

MIT license.


Copyright

Copyright © 2014. Athan Reines.