Skip to content

Commit 8468926

Browse files
committed
chore: fixed linting and clean-up
1 parent 002035b commit 8468926

File tree

9 files changed

+19
-26
lines changed

9 files changed

+19
-26
lines changed

lib/node_modules/@stdlib/stats/incr/nanewstdev/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# incrnanewstdev
2222

23-
> Compute an [exponentially weighted standard deviation][moving-average] incrementally.
23+
> Compute an [exponentially weighted standard deviation][moving-average] incrementally, ignoring `NaN` values.
2424
2525
<section class="intro">
2626

@@ -55,7 +55,7 @@ var incrnanewstdev = require( '@stdlib/stats/incr/nanewstdev' );
5555

5656
#### incrnanewstdev( alpha )
5757

58-
Returns an accumulator `function` which incrementally computes an [exponentially weighted standard deviation][moving-average], where `alpha` is a smoothing factor between `0` and `1`.
58+
Returns an accumulator `function` which incrementally computes an [exponentially weighted standard deviation][moving-average], where `alpha` is a smoothing factor between `0` and `1`, ignoring `NaN` values.
5959

6060
```javascript
6161
var accumulator = incrnanewstdev( 0.5 );
@@ -95,7 +95,7 @@ s = accumulator();
9595

9696
## Notes
9797

98-
- Input values are **not** type checked. If provided `NaN` or a value which, when used in computations, results in `NaN`, it will be **ignored** but you are advised to type check and handle accordingly **before** passing the value to the accumulator function.
98+
- Input values are **not** type checked.If non-numeric inputs are possible, but you are advised to type check and handle accordingly **before** passing the value to the accumulator function.
9999

100100
</section>
101101

@@ -109,8 +109,8 @@ s = accumulator();
109109

110110
```javascript
111111
var randu = require( '@stdlib/random/base/randu' );
112-
var incrnanewstdev = require( './../lib' );
113112
var isnan = require( '@stdlib/math/base/assert/is-nan' );
113+
var incrnanewstdev = require( '@stdlib/stats/incr/nanewstdev' );
114114

115115
var accumulator;
116116
var s;

lib/node_modules/@stdlib/stats/incr/nanewstdev/benchmark/benchmark.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
2524
var pkg = require( './../package.json' ).name;
2625
var incrnanewstdev = require( './../lib' );
2726

@@ -55,7 +54,7 @@ bench( pkg+'::accumulator', function benchmark( b ) {
5554

5655
b.tic();
5756
for ( i = 0; i < b.iterations; i++ ) {
58-
v = acc( randu() );
57+
v = acc( i );
5958
if ( v !== v ) {
6059
b.fail( 'should not return NaN' );
6160
}

lib/node_modules/@stdlib/stats/incr/nanewstdev/docs/repl.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
{{alias}}( α )
33
Returns an accumulator function which incrementally computes an
44
exponentially weighted standard deviation, where α is a smoothing factor
5-
between 0 and 1.
5+
between 0 and 1, ignoring `NaN` values.
66

77
If provided a value, the accumulator function returns an updated standard
88
deviation. If not provided a value, the accumulator function returns the
99
current standard deviation.
1010

11-
If provided `NaN` or a value which, when used in computations, results in
12-
`NaN`, it will be ignored by accumulator function.
13-
1411
Parameters
1512
----------
1613
α: number

lib/node_modules/@stdlib/stats/incr/nanewstdev/docs/types/index.d.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@
2323
/**
2424
* If provided a value, the accumulator function returns an updated standard deviation. If not provided a value, the accumulator function returns the current standard deviation.
2525
*
26-
* ## Notes
27-
*
28-
* - If provided `NaN` or a value which, when used in computations, results in `NaN`, it will be ignored.
29-
*
3026
* @param x - value
3127
* @returns standard deviation or null
3228
*/
3329
type accumulator = ( x?: number ) => number | null;
3430

3531
/**
36-
* Returns an accumulator function which incrementally computes an exponentially weighted standard deviation.
32+
* Returns an accumulator function which incrementally computes an exponentially weighted standard deviation, ignoring `NaN` values.
3733
*
3834
* @param alpha - smoothing factor
3935
* @throws must be on the interval `[0,1]`
@@ -48,7 +44,7 @@ type accumulator = ( x?: number ) => number | null;
4844
* s = accumulator( 2.0 );
4945
* // returns 0.0
5046
*
51-
* s = accumulator( NaN ); // ignored
47+
* s = accumulator( NaN );
5248
* // returns 0.0
5349
*
5450
* s = accumulator( -5.0 );

lib/node_modules/@stdlib/stats/incr/nanewstdev/examples/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
'use strict';
2020

2121
var randu = require( '@stdlib/random/base/randu' );
22-
var incrnanewstdev = require( './../lib' );
2322
var isnan = require( '@stdlib/math/base/assert/is-nan' );
23+
var incrnanewstdev = require( './../lib' );
2424

2525
var accumulator;
2626
var s;
@@ -33,8 +33,8 @@ accumulator = incrnanewstdev( 0.5 );
3333
// For each simulated datum, update the exponentially weighted standard deviation...
3434
console.log( '\nValue\tStDev\n' );
3535
for ( i = 0; i < 100; i++ ) {
36-
v = (randu() < 0.1) ? NaN : randu() * 100.0; // 10% chance of a NaN
36+
v = ( randu() < 0.1 ) ? NaN : randu() * 100.0; // 10% chance of a NaN
3737
s = accumulator( v );
38-
console.log( '%d\t%d', isnan(v) ? 'NaN' : v.toFixed( 4 ), s.toFixed( 4 ) );
38+
console.log( '%d\t%d', ( isnan(v) ) ? 'NaN' : v.toFixed( 4 ), s.toFixed( 4 ) );
3939
}
4040
console.log( '\nFinal StDev: %d\n', accumulator() );

lib/node_modules/@stdlib/stats/incr/nanewstdev/lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
/**
22-
* Compute an exponentially weighted standard deviation incrementally.
22+
* Compute an exponentially weighted standard deviation incrementally, ignoring `NaN` values.
2323
*
2424
* @module @stdlib/stats/incr/nanewstdev
2525
*
@@ -34,7 +34,7 @@
3434
* s = accumulator( 2.0 );
3535
* // returns 0.0
3636
*
37-
* s = accumulator( NaN ); // ignored
37+
* s = accumulator( NaN );
3838
* // returns 0.0
3939
*
4040
* s = accumulator( -5.0 );

lib/node_modules/@stdlib/stats/incr/nanewstdev/lib/main.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
// MODULES //
2222

2323
var isnan = require( '@stdlib/math/base/assert/is-nan' );
24-
var increwstdev = require('@stdlib/stats/incr/ewstdev');
24+
var increwstdev = require( '@stdlib/stats/incr/ewstdev' );
25+
2526

2627
// MAIN //
2728

@@ -42,7 +43,7 @@ var increwstdev = require('@stdlib/stats/incr/ewstdev');
4243
* s = accumulator( 2.0 );
4344
* // returns 0.0
4445
*
45-
* s = accumulator( NaN ); // ignored
46+
* s = accumulator( NaN );
4647
* // returns 0.0
4748
*
4849
* s = accumulator( -5.0 );

lib/node_modules/@stdlib/stats/incr/nanewstdev/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stdlib/stats/incr/nanewstdev",
33
"version": "0.0.0",
4-
"description": "Compute an exponentially weighted standard deviation incrementally.",
4+
"description": "Compute an exponentially weighted standard deviation incrementally, ignoring `NaN` values.",
55
"license": "Apache-2.0",
66
"author": {
77
"name": "The Stdlib Authors",

lib/node_modules/@stdlib/stats/incr/nanewstdev/test/test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ tape( 'the accumulator function incrementally computes an exponentially weighted
127127
sqrt( (0.5*0.859375) + (0.25*pow( 3.0-3.125, 2 )) ), // m = 3.0625, s2 = 0.43359375
128128
sqrt( (0.5*0.43359375) + (0.25*pow( 4.0-3.0625, 2 )) ) // m = 3.53125, s2 = 0.4365234375
129129
];
130-
actual = new Array( N );
130+
actual = [];
131131

132132
acc = incrnanewstdev( 0.5 );
133133

134134
for ( i = 0; i < N; i++ ) {
135-
actual[ i ] = acc( data[ i ] );
135+
actual.push( acc( data[ i ] ) );
136136
}
137137
t.deepEqual( actual, expected, 'returns expected values' );
138138
t.end();

0 commit comments

Comments
 (0)