Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "stats/incr/nansum/docs/types/index.d"

Index

Type aliases

Functions

Type aliases

accumulator

accumulator: (x?: undefined | number) => number | null

If provided a value, returns an updated sum; otherwise, returns the current sum.

param

value

returns

sum

Type declaration

    • (x?: undefined | number): number | null
    • Parameters

      • Optional x: undefined | number

      Returns number | null

Functions

Export assignment incrnansum

  • Returns an accumulator function which incrementally computes a sum, ignoring NaN values.

    Returns accumulator

    accumulator function

    Example

    var accumulator = incrnansum();
    
    var v = accumulator();
    // returns null
    
    v = accumulator( 2.0 );
    // returns 2.0
    
    v = accumulator( 3.0 );
    // returns 5.0
    
    v = accumulator( NaN );
    // returns 5.0
    
    v = accumulator( 4.0 );
    // returns 9.0
    
    v = accumulator();
    // returns 9.0