Skip to content

Commit 79eb09a

Browse files
committed
refactor: use as sentinel
--- 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: na - 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 c9734b5 commit 79eb09a

32 files changed

+101
-99
lines changed

lib/node_modules/@stdlib/ndarray/base/find/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ var ox = 0;
6868
// Create the sentinel value ndarray-like object:
6969
var sentinelValue = {
7070
'dtype': 'float64',
71-
'data': new Float64Array( [ -1.0 ] ),
71+
'data': new Float64Array( [ NaN ] ),
7272
'shape': [],
7373
'strides': [ 0 ],
7474
'offset': 0,
@@ -138,7 +138,7 @@ var ox = 0;
138138
// Create the sentinel value ndarray-like object:
139139
var sentinelValue = {
140140
'dtype': 'float64',
141-
'data': new Float64Array( [ -1.0 ] ),
141+
'data': new Float64Array( [ NaN ] ),
142142
'shape': [],
143143
'strides': [ 0 ],
144144
'offset': 0,
@@ -189,6 +189,7 @@ var count = ctx.count;
189189

190190
```javascript
191191
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
192+
var Float64Array = require( '@stdlib/array/float64' );
192193
var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
193194
var find = require( '@stdlib/ndarray/base/find' );
194195

@@ -197,9 +198,9 @@ function clbk( value ) {
197198
}
198199

199200
var x = {
200-
'dtype': 'generic',
201-
'data': discreteUniform( 10, 0, 10, {
202-
'dtype': 'generic'
201+
'dtype': 'float64',
202+
'data': discreteUniform( 10, 0.0, 10.0, {
203+
'dtype': 'float64'
203204
}),
204205
'shape': [ 5, 2 ],
205206
'strides': [ 2, 1 ],
@@ -209,8 +210,8 @@ var x = {
209210
console.log( ndarray2array( x.data, x.shape, x.strides, x.offset, x.order ) );
210211

211212
var sv = {
212-
'dtype': x.dtype,
213-
'data': [ -1 ],
213+
'dtype': 'float64',
214+
'data': new Float64Array( [ NaN ] ),
214215
'shape': [],
215216
'strides': [ 0 ],
216217
'offset': 0,

lib/node_modules/@stdlib/ndarray/base/find/benchmark/benchmark.1d_columnmajor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// MODULES //
2424

2525
var bench = require( '@stdlib/bench' );
26-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
2929
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
@@ -73,7 +73,7 @@ function createBenchmark( len, shape, xtype ) {
7373
};
7474
sv = {
7575
'dtype': xtype,
76-
'data': [ -1.0 ],
76+
'data': [ NaN ],
7777
'shape': [],
7878
'strides': [ 0 ],
7979
'offset': 0,
@@ -94,13 +94,13 @@ function createBenchmark( len, shape, xtype ) {
9494
b.tic();
9595
for ( i = 0; i < b.iterations; i++ ) {
9696
out = find( [ x, sv ], clbk );
97-
if ( isnan( out ) ) {
98-
b.fail( 'should not return NaN' );
97+
if ( isInteger( out ) ) {
98+
b.fail( 'should not return an integer' );
9999
}
100100
}
101101
b.toc();
102-
if ( isnan( out ) ) {
103-
b.fail( 'should not return NaN' );
102+
if ( isInteger( out ) ) {
103+
b.fail( 'should not return an integer' );
104104
}
105105
b.pass( 'benchmark finished' );
106106
b.end();

lib/node_modules/@stdlib/ndarray/base/find/benchmark/benchmark.1d_rowmajor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// MODULES //
2424

2525
var bench = require( '@stdlib/bench' );
26-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
2929
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
@@ -73,7 +73,7 @@ function createBenchmark( len, shape, xtype ) {
7373
};
7474
sv = {
7575
'dtype': xtype,
76-
'data': [ -1.0 ],
76+
'data': [ NaN ],
7777
'shape': [],
7878
'strides': [ 0 ],
7979
'offset': 0,
@@ -94,13 +94,13 @@ function createBenchmark( len, shape, xtype ) {
9494
b.tic();
9595
for ( i = 0; i < b.iterations; i++ ) {
9696
out = find( [ x, sv ], clbk );
97-
if ( isnan( out ) ) {
98-
b.fail( 'should not return NaN' );
97+
if ( isInteger( out ) ) {
98+
b.fail( 'should not return an integer' );
9999
}
100100
}
101101
b.toc();
102-
if ( isnan( out ) ) {
103-
b.fail( 'should not return NaN' );
102+
if ( isInteger( out ) ) {
103+
b.fail( 'should not return an integer' );
104104
}
105105
b.pass( 'benchmark finished' );
106106
b.end();

lib/node_modules/@stdlib/ndarray/base/find/benchmark/benchmark.2d_blocked_columnmajor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// MODULES //
2424

2525
var bench = require( '@stdlib/bench' );
26-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var sqrt = require( '@stdlib/math/base/special/sqrt' );
2929
var floor = require( '@stdlib/math/base/special/floor' );
@@ -86,14 +86,14 @@ function createBenchmark( len, shape, xtype ) {
8686

8787
b.tic();
8888
for ( i = 0; i < b.iterations; i++ ) {
89-
out = find( x, -1, clbk );
90-
if ( isnan( out ) ) {
91-
b.fail( 'should not return NaN' );
89+
out = find( x, NaN, clbk );
90+
if ( isInteger( out ) ) {
91+
b.fail( 'should not return an integer' );
9292
}
9393
}
9494
b.toc();
95-
if ( isnan( out ) ) {
96-
b.fail( 'should not return NaN' );
95+
if ( isInteger( out ) ) {
96+
b.fail( 'should not return an integer' );
9797
}
9898
b.pass( 'benchmark finished' );
9999
b.end();

lib/node_modules/@stdlib/ndarray/base/find/benchmark/benchmark.2d_blocked_rowmajor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// MODULES //
2424

2525
var bench = require( '@stdlib/bench' );
26-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var sqrt = require( '@stdlib/math/base/special/sqrt' );
2929
var floor = require( '@stdlib/math/base/special/floor' );
@@ -86,14 +86,14 @@ function createBenchmark( len, shape, xtype ) {
8686

8787
b.tic();
8888
for ( i = 0; i < b.iterations; i++ ) {
89-
out = find( x, -1, clbk );
90-
if ( isnan( out ) ) {
91-
b.fail( 'should not return NaN' );
89+
out = find( x, NaN, clbk );
90+
if ( isInteger( out ) ) {
91+
b.fail( 'should not return an integer' );
9292
}
9393
}
9494
b.toc();
95-
if ( isnan( out ) ) {
96-
b.fail( 'should not return NaN' );
95+
if ( isInteger( out ) ) {
96+
b.fail( 'should not return an integer' );
9797
}
9898
b.pass( 'benchmark finished' );
9999
b.end();

lib/node_modules/@stdlib/ndarray/base/find/benchmark/benchmark.2d_columnmajor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// MODULES //
2424

2525
var bench = require( '@stdlib/bench' );
26-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var sqrt = require( '@stdlib/math/base/special/sqrt' );
2929
var floor = require( '@stdlib/math/base/special/floor' );
@@ -86,14 +86,14 @@ function createBenchmark( len, shape, xtype ) {
8686

8787
b.tic();
8888
for ( i = 0; i < b.iterations; i++ ) {
89-
out = find( x, -1, clbk );
90-
if ( isnan( out ) ) {
91-
b.fail( 'should not return NaN' );
89+
out = find( x, NaN, clbk );
90+
if ( isInteger( out ) ) {
91+
b.fail( 'should not return an integer' );
9292
}
9393
}
9494
b.toc();
95-
if ( isnan( out ) ) {
96-
b.fail( 'should not return NaN' );
95+
if ( isInteger( out ) ) {
96+
b.fail( 'should not return an integer' );
9797
}
9898
b.pass( 'benchmark finished' );
9999
b.end();

lib/node_modules/@stdlib/ndarray/base/find/benchmark/benchmark.2d_rowmajor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// MODULES //
2424

2525
var bench = require( '@stdlib/bench' );
26-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var sqrt = require( '@stdlib/math/base/special/sqrt' );
2929
var floor = require( '@stdlib/math/base/special/floor' );
@@ -86,14 +86,14 @@ function createBenchmark( len, shape, xtype ) {
8686

8787
b.tic();
8888
for ( i = 0; i < b.iterations; i++ ) {
89-
out = find( x, -1, clbk );
90-
if ( isnan( out ) ) {
91-
b.fail( 'should not return NaN' );
89+
out = find( x, NaN, clbk );
90+
if ( isInteger( out ) ) {
91+
b.fail( 'should not return an integer' );
9292
}
9393
}
9494
b.toc();
95-
if ( isnan( out ) ) {
96-
b.fail( 'should not return NaN' );
95+
if ( isInteger( out ) ) {
96+
b.fail( 'should not return an integer' );
9797
}
9898
b.pass( 'benchmark finished' );
9999
b.end();

lib/node_modules/@stdlib/ndarray/base/find/benchmark/benchmark.2d_rowmajor_accessors.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// MODULES //
2424

2525
var bench = require( '@stdlib/bench' );
26-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var sqrt = require( '@stdlib/math/base/special/sqrt' );
2929
var floor = require( '@stdlib/math/base/special/floor' );
@@ -112,14 +112,14 @@ function createBenchmark( len, shape, xtype ) {
112112

113113
b.tic();
114114
for ( i = 0; i < b.iterations; i++ ) {
115-
out = find( x, -1, clbk );
116-
if ( isnan( out ) ) {
117-
b.fail( 'should not return NaN' );
115+
out = find( x, NaN, clbk );
116+
if ( isInteger( out ) ) {
117+
b.fail( 'should not return an integer' );
118118
}
119119
}
120120
b.toc();
121-
if ( isnan( out ) ) {
122-
b.fail( 'should not return NaN' );
121+
if ( isInteger( out ) ) {
122+
b.fail( 'should not return an integer' );
123123
}
124124
b.pass( 'benchmark finished' );
125125
b.end();

lib/node_modules/@stdlib/ndarray/base/find/benchmark/benchmark.3d_blocked_columnmajor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// MODULES //
2424

2525
var bench = require( '@stdlib/bench' );
26-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var cbrt = require( '@stdlib/math/base/special/cbrt' );
2929
var floor = require( '@stdlib/math/base/special/floor' );
@@ -86,14 +86,14 @@ function createBenchmark( len, shape, xtype ) {
8686

8787
b.tic();
8888
for ( i = 0; i < b.iterations; i++ ) {
89-
out = find( x, -1, clbk );
90-
if ( isnan( out ) ) {
91-
b.fail( 'should not return NaN' );
89+
out = find( x, NaN, clbk );
90+
if ( isInteger( out ) ) {
91+
b.fail( 'should not return an integer' );
9292
}
9393
}
9494
b.toc();
95-
if ( isnan( out ) ) {
96-
b.fail( 'should not return NaN' );
95+
if ( isInteger( out ) ) {
96+
b.fail( 'should not return an integer' );
9797
}
9898
b.pass( 'benchmark finished' );
9999
b.end();

lib/node_modules/@stdlib/ndarray/base/find/benchmark/benchmark.3d_blocked_rowmajor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// MODULES //
2424

2525
var bench = require( '@stdlib/bench' );
26-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var cbrt = require( '@stdlib/math/base/special/cbrt' );
2929
var floor = require( '@stdlib/math/base/special/floor' );
@@ -86,14 +86,14 @@ function createBenchmark( len, shape, xtype ) {
8686

8787
b.tic();
8888
for ( i = 0; i < b.iterations; i++ ) {
89-
out = find( x, -1, clbk );
90-
if ( isnan( out ) ) {
91-
b.fail( 'should not return NaN' );
89+
out = find( x, NaN, clbk );
90+
if ( isInteger( out ) ) {
91+
b.fail( 'should not return an integer' );
9292
}
9393
}
9494
b.toc();
95-
if ( isnan( out ) ) {
96-
b.fail( 'should not return NaN' );
95+
if ( isInteger( out ) ) {
96+
b.fail( 'should not return an integer' );
9797
}
9898
b.pass( 'benchmark finished' );
9999
b.end();

0 commit comments

Comments
 (0)