Skip to content

Commit 6eec469

Browse files
committed
chore: minor 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 status: passed - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - 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: na - task: lint_license_headers status: passed ---
1 parent 46c3485 commit 6eec469

File tree

7 files changed

+33
-48
lines changed

7 files changed

+33
-48
lines changed

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

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ min = accumulator();
7070
## Notes
7171

7272
- Input values are **not** type checked. If non-numeric inputs are possible, you are advised to type check and handle accordingly **before** passing the value to the accumulator function.
73-
- If all values provided are `NaN`, the accumulator returns `NaN`.
73+
- If all provided values are `NaN`, the accumulator returns `null`.
7474

7575
</section>
7676

@@ -81,7 +81,8 @@ min = accumulator();
8181
## Examples
8282

8383
```javascript
84-
var randu = require( '@stdlib/random/base/randu' );
84+
var bernoulli = require( '@stdlib/random/base/bernoulli' );
85+
var uniform = require( '@stdlib/random/base/uniform' );
8586
var incrnanmin = require( '@stdlib/stats/incr/nanmin' );
8687

8788
var accumulator;
@@ -93,10 +94,10 @@ accumulator = incrnanmin();
9394

9495
// For each simulated datum, update the min...
9596
for ( i = 0; i < 100; i++ ) {
96-
if ( randu() < 0.2 ) {
97+
if ( bernoulli( 0.2 ) ) {
9798
v = NaN;
9899
} else {
99-
v = randu() * 100.0;
100+
v = uniform( 0.0, 100.0 );
100101
}
101102
accumulator( v );
102103
}
@@ -111,14 +112,6 @@ console.log( accumulator() );
111112

112113
<section class="related">
113114

114-
* * *
115-
116-
## See Also
117-
118-
- <span class="package-name">[`@stdlib/stats/incr/min`][@stdlib/stats/incr/min]</span><span class="delimiter">: </span><span class="description">compute a minimum value incrementally.</span>
119-
- <span class="package-name">[`@stdlib/stats/incr/mmin`][@stdlib/stats/incr/mmin]</span><span class="delimiter">: </span><span class="description">compute a moving minimum incrementally.</span>
120-
- <span class="package-name">[`@stdlib/stats/incr/nanmax`][@stdlib/stats/incr/nanmax]</span><span class="delimiter">: </span><span class="description">compute a maximum value incrementally, ignoring NaN values.</span>
121-
122115
</section>
123116

124117
<!-- /.related -->
@@ -129,12 +122,6 @@ console.log( accumulator() );
129122

130123
<!-- <related-links> -->
131124

132-
[@stdlib/stats/incr/min]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/min
133-
134-
[@stdlib/stats/incr/mmin]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mmin
135-
136-
[@stdlib/stats/incr/nanmax]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/nanmax
137-
138125
<!-- </related-links> -->
139126

140127
</section>

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
/// <reference types="@stdlib/types"/>
2222

2323
/**
24-
* Returns an accumulator function which incrementally computes a minimum value, ignoring `NaN` values
24+
* If provided a value, returns an updated minimum value; otherwise, returns the current minimum value.
25+
*
2526
* @param x - value
2627
* @returns minimum value
2728
*/
@@ -38,19 +39,19 @@ type accumulator = ( x?: number ) => number | null;
3839
* var m = accumulator();
3940
* // returns null
4041
*
41-
* m = accumulator(3.14);
42+
* m = accumulator( 3.14 );
4243
* // returns 3.14
4344
*
44-
* m = accumulator(NaN);
45+
* m = accumulator( NaN );
4546
* // returns 3.14
4647
*
47-
* m = accumulator(-5.0);
48+
* m = accumulator( -5.0 );
4849
* // returns -5.0
4950
*
50-
* m = accumulator(10.1);
51+
* m = accumulator( 10.1 );
5152
* // returns -5.0
5253
*
53-
* m = accumulator(NaN);
54+
* m = accumulator( NaN );
5455
* // returns -5.0
5556
*
5657
* m = accumulator();

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

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,21 @@
1818

1919
'use strict';
2020

21-
var randu = require( '@stdlib/random/base/randu' );
21+
var bernoulli = require( '@stdlib/random/base/bernoulli' );
22+
var uniform = require( '@stdlib/random/base/uniform' );
2223
var incrnanmin = require( './../lib' );
2324

24-
var accumulator;
25-
var min;
26-
var v;
27-
var i;
28-
2925
// Initialize an accumulator:
30-
accumulator = incrnanmin();
26+
var accumulator = incrnanmin();
3127

3228
// For each simulated datum, update the min...
3329
console.log( '\nValue\tMin\n' );
30+
var min;
31+
var v;
32+
var i;
3433
for ( i = 0; i < 100; i++ ) {
35-
if ( randu() < 0.2 ) {
36-
v = NaN;
37-
} else {
38-
v = randu() * 100.0;
39-
}
34+
v = ( bernoulli( 0.2 ) ) ? NaN : uniform( 0.0, 100.0 );
4035
min = accumulator( v );
41-
console.log( '%d\t%d', v.toFixed( 4 ), ( min === null ) ? NaN : min.toFixed( 4 ) );
36+
console.log( '%s\t%s', ( v === v ) ? v.toFixed( 4 ) : 'NaN', ( min === null ) ? 'null' : min.toFixed( 4 ) );
4237
}
4338
console.log( '\nFinal min: %d\n', accumulator() );

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,24 @@
2424
* @module @stdlib/stats/incr/nanmin
2525
*
2626
* @example
27-
* var incrnanmin = require( '@stdlib/stats/incr/nanmin' )
27+
* var incrnanmin = require( '@stdlib/stats/incr/nanmin' );
2828
*
2929
* var accumulator = incrnanmin();
3030
*
3131
* var min = accumulator();
3232
* // returns null
3333
*
34-
* min = accumulator(3.14);
34+
* min = accumulator( 3.14 );
3535
* // returns 3.14
3636
*
37-
* min = accumulator(-5.0);
37+
* min = accumulator( -5.0 );
3838
* // returns -5.0
3939
*
40-
* min = accumulator(NaN);
40+
* min = accumulator( NaN );
4141
* // returns -5.0
4242
*
4343
* min = accumulator( 10.1 );
44-
* returns -5.0
44+
* // returns -5.0
4545
*
4646
* min = accumulator();
4747
* // returns -5.0

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ var incrmin = require( '@stdlib/stats/incr/min' );
3737
* var min = accumulator();
3838
* // returns null
3939
*
40-
* min = accumulator(3.14);
40+
* min = accumulator( 3.14 );
4141
* // returns 3.14
4242
*
43-
* min = accumulator(-5.0);
43+
* min = accumulator( -5.0 );
4444
* // returns -5.0
4545
*
46-
* min = accumulator(NaN);
46+
* min = accumulator( NaN );
4747
* // returns -5.0
4848
*
4949
* min = accumulator( 10.1 );
@@ -57,7 +57,7 @@ function incrnanmin() {
5757
return accumulator;
5858

5959
/**
60-
* If provided a value, the accumulator function returns an updated minimum value. If not provided a value, the accumulator function returns the current min.
60+
* If provided a value, the accumulator function returns an updated minimum value. If not provided a value, the accumulator function returns the current minimum value.
6161
*
6262
* @private
6363
* @param {number} [x] - new value

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
"domain",
6363
"extent",
6464
"incremental",
65-
"accumulator"
65+
"accumulator",
66+
"nan",
67+
"ignore"
6668
]
6769
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ tape( 'the accumulator function incrementally computes a minimum value', functio
5656
var d;
5757
var i;
5858

59-
data = [2.0, 3.0, NaN, 1.0, 4.0, NaN, 3.0, 4.0 ];
59+
data = [ 2.0, 3.0, NaN, 1.0, 4.0, NaN, 3.0, 4.0 ];
6060
N = data.length;
6161

6262
expected = [];

0 commit comments

Comments
 (0)