Skip to content

Commit f28ac37

Browse files
committed
chore: clean-up
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent cc7fbc9 commit f28ac37

7 files changed

Lines changed: 17 additions & 30 deletions

File tree

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,13 @@ r = accumulator();
105105
var randu = require( '@stdlib/random/base/randu' );
106106
var incrnanmrange = require( '@stdlib/stats/incr/nanmrange' );
107107

108-
var accumulator;
109-
var r;
110-
var v;
111-
var i;
112-
113108
// Initialize an accumulator:
114-
accumulator = incrnanmrange( 5 );
109+
var accumulator = incrnanmrange( 5 );
115110

116111
// For each simulated datum, update the moving range...
112+
var i;
117113
for ( i = 0; i < 100; i++ ) {
118-
if ( randu() < 0.2 ) {
119-
v = NaN;
120-
} else {
121-
v = randu() * 100.0;
122-
}
123-
r = accumulator( v );
114+
accumulator( ( randu() < 0.2 ) ? NaN : randu()*100.0 );
124115
}
125116
console.log( accumulator() );
126117
```

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
24+
var format = require( '@stdlib/string/format' );
2525
var pkg = require( './../package.json' ).name;
2626
var incrnanmrange = require( './../lib' );
2727

@@ -46,7 +46,7 @@ bench( pkg, function benchmark( b ) {
4646
b.end();
4747
});
4848

49-
bench( pkg+'::accumulator', function benchmark( b ) {
49+
bench( format( '%s::accumulator', pkg ), function benchmark( b ) {
5050
var acc;
5151
var v;
5252
var i;
@@ -55,7 +55,7 @@ bench( pkg+'::accumulator', function benchmark( b ) {
5555

5656
b.tic();
5757
for ( i = 0; i < b.iterations; i++ ) {
58-
v = acc( randu() );
58+
v = acc( i );
5959
if ( v !== v ) {
6060
b.fail( 'should not return NaN' );
6161
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
{{alias}}( W )
3-
Returns an accumulator function which incrementally computes a moving
4-
range, ignoring NaN values.
3+
Returns an accumulator function which incrementally computes a moving range,
4+
ignoring NaN values.
55

66
The `W` parameter defines the number of values over which to compute the
77
moving range.
@@ -14,8 +14,8 @@
1414
values are calculated from smaller sample sizes. Until the window is full,
1515
each returned value is calculated from all provided values.
1616

17-
NaN values are ignored during computation. If provided NaN, the
18-
accumulator returns the current range.
17+
NaN values are ignored during computation. If provided NaN, the accumulator
18+
returns the current range.
1919

2020
Parameters
2121
----------

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ type accumulator = ( x?: number ) => number | null;
4040
*
4141
* - The `W` parameter defines the number of values over which to compute the moving range.
4242
* - As `W` values are needed to fill the window buffer, the first `W-1` returned values are calculated from smaller sample sizes. Until the window is full, each returned value is calculated from all provided values.
43-
* - `NaN` values are ignored.
4443
*
4544
* @param W - window size
4645
* @throws must provide a positive integer

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@
2121
var randu = require( '@stdlib/random/base/randu' );
2222
var incrnanmrange = require( './../lib' );
2323

24-
var accumulator;
25-
var r;
26-
var v;
27-
var i;
28-
2924
// Initialize an accumulator:
30-
accumulator = incrnanmrange( 5 );
25+
var accumulator = incrnanmrange( 5 );
3126

3227
// For each simulated datum, update the moving range...
3328
console.log( '\nValue\tRange\n' );
29+
var r;
30+
var v;
31+
var i;
3432
for ( i = 0; i < 100; i++ ) {
3533
if ( randu() < 0.2 ) {
3634
v = NaN;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
/**
22-
* Compute a moving range incrementally, ignoring NaN values.
22+
* Compute a moving range incrementally, ignoring `NaN` values.
2323
*
2424
* @module @stdlib/stats/incr/nanmrange
2525
*

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stdlib/stats/incr/nanmrange",
33
"version": "0.0.0",
4-
"description": "Compute a moving range incrementally, ignoring NaN values.",
4+
"description": "Compute a moving range incrementally, ignoring `NaN` values.",
55
"license": "Apache-2.0",
66
"author": {
77
"name": "The Stdlib Authors",
@@ -70,7 +70,6 @@
7070
"sliding",
7171
"window",
7272
"moving",
73-
"nan",
74-
"ignore"
73+
"nan"
7574
]
7675
}

0 commit comments

Comments
 (0)