Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    flow-quantilespublic

    flow-quantiles

    Reduce transform stream which computes the quantiles over a stream of numeric data.

    Note: in order to calculate the quantiles exactly, all data must be buffered into memory. As a result, this stream acts as a sink. Use caution when applying the transform to large datasets.

    Installation

    $ npm install flow-quantiles

    Examples

    var eventStream = require( 'event-stream' ),
        qStream = require( 'flow-quantiles' );
     
    // Create some data... 
    var data = new Array( 1000 );
    for ( var i = 0; i < data.length; i++ ) {
        data[ i ] = Math.round( Math.random() * 100 );
    }
     
    // Create a readable stream: 
    var readStream = eventStream.readArray( data );
     
    // Create a new quantiles stream: 
    var stream = qStream()
        .quantiles( 10 )
        .stream();
     
    // Pipe the data: 
    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.

    install

    npm i flow-quantiles

    Downloadsweekly downloads

    3

    version

    0.0.5

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar