Skip to content

Commit 5d543ed

Browse files
committed
lint error
--- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed ---
1 parent d74bbfd commit 5d543ed

File tree

5 files changed

+89
-54
lines changed

5 files changed

+89
-54
lines changed
Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,124 @@
1-
21
{{alias}}( N, x, strideX )
2+
3+
34
Computes the range of a strided array.
45

5-
The `N` and stride parameters determine which elements in the strided array are accessed
6-
at runtime.
76

8-
Indexing is relative to the first index. To introduce an offset, use a typed
9-
array view.
7+
The `N` and stride parameters determine which elements in the strided
8+
array are accessed at runtime.
9+
10+
11+
Indexing is relative to the first index. To introduce an offset, use a
12+
typed array view.
13+
1014

1115
If `N <= 0`, the function returns `NaN`.
1216

17+
1318
Parameters
1419
----------
20+
21+
1522
N: integer
1623
Number of indexed elements.
1724

25+
1826
x: Array<number>|TypedArray
1927
Input array.
2028

29+
2130
strideX: integer
2231
Stride length.
2332

33+
2434
Returns
2535
-------
36+
37+
2638
out: number
2739
Range.
2840

41+
2942
Examples
3043
--------
44+
45+
3146
// Standard Usage:
3247
> var x = [ 1.0, -2.0, 2.0 ];
3348
> {{alias}}( x.length, x, 1 )
3449
4.0
3550

51+
3652
// Using `N` and stride parameters:
3753
> x = [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ];
3854
> var stride = 2;
3955
> {{alias}}( 3, x, stride )
4056
4.0
4157

58+
4259
// Using view offsets:
4360
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
4461
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
4562
> stride = 2;
4663
> {{alias}}( 3, x1, stride )
4764
4.0
4865

66+
4967
{{alias}}.ndarray( N, x, strideX, offsetX )
50-
Computes the range of a strided array using alternative indexing semantics.
68+
69+
70+
Computes the range of a strided array using alternative indexing
71+
semantics.
72+
5173

5274
While typed array views mandate a view offset based on the underlying
5375
buffer, the `offset` parameter supports indexing semantics based on a
5476
starting index.
5577

78+
5679
Parameters
5780
----------
81+
82+
5883
N: integer
5984
Number of indexed elements.
6085

86+
6187
x: Array<number>|TypedArray
6288
Input array.
6389

90+
6491
strideX: integer
6592
Stride length.
6693

94+
6795
offsetX: integer
6896
Starting index.
6997

98+
7099
Returns
71100
-------
101+
102+
72103
out: number
73104
Range.
74105

106+
75107
Examples
76108
--------
109+
110+
77111
// Standard Usage:
78112
> var x = [ 1.0, -2.0, 2.0 ];
79113
> {{alias}}.ndarray( x.length, x, 1, 0 )
80114
4.0
81115

116+
82117
// Using offset parameter:
83118
> var x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ];
84119
> {{alias}}.ndarray( 3, x, 2, 1 )
85120
4.0
86121

87-
See Also
88-
--------
89122

123+
See Also
124+
--------

lib/node_modules/@stdlib/stats/base/range/lib/accessors.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ function range( N, x, get, stride ) {
5252
return NaN;
5353
}
5454
if ( N === 1 || stride === 0 ) {
55-
let v = get( x, 0 );
56-
return isnan( v ) ? NaN : 0.0;
55+
const v = get( x, 0 );
56+
return ( isnan(v) ) ? NaN : 0.0;
5757
}
58-
59-
let ix = stride < 0 ? (1 - N) * stride : 0;
58+
59+
let ix = ( stride < 0 ) ? ( ( 1 - N ) * stride ) : 0;
6060
let min = get( x, ix );
6161
let max = min;
6262

6363
for ( let i = 1; i < N; i++ ) {
6464
ix += stride;
65-
let v = get( x, ix );
65+
const v = get( x, ix );
6666

6767
if ( isnan( v ) ) {
6868
return NaN;

lib/node_modules/@stdlib/stats/base/range/lib/ndarray.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,40 +45,40 @@ var accessors = require( './accessors.js' );
4545
* // returns 6.0
4646
*/
4747
function range( N, x, strideX, offsetX ) {
48-
var obj = arraylike2object( x ); // Convert input to object with `data` property
49-
var data = obj.data; // Extract data directly
48+
var obj = arraylike2object( x );
49+
var data = obj.data;
5050

51-
var max;
52-
var min;
53-
var ix;
54-
var v;
55-
var i;
51+
var max;
52+
var min;
53+
var ix;
54+
var v;
55+
var i;
5656

57-
if ( N <= 0 ) {
58-
return NaN;
59-
}
60-
if ( N === 1 || strideX === 0 ) {
61-
v = data[offsetX]; // Direct access instead of using an accessor function
62-
return isnan( v ) ? NaN : 0.0;
63-
}
64-
ix = offsetX;
65-
min = data[ix]; // Direct access
66-
max = min;
67-
for ( i = 1; i < N; i++ ) {
68-
ix += strideX;
69-
v = data[ix]; // Direct access
70-
if ( isnan( v ) ) {
71-
return v;
72-
}
73-
if ( v < min ) {
74-
min = v;
75-
} else if ( v > max ) {
76-
max = v;
77-
}
78-
}
79-
return max - min;
57+
if ( N <= 0 ) {
58+
return NaN;
59+
}
60+
if ( N === 1 || strideX === 0 ) {
61+
v = data[offsetX]; // Direct access instead of using an accessor function
62+
return isnan( v ) ? NaN : 0.0;
63+
}
64+
ix = offsetX;
65+
min = data[ix]; // Direct access
66+
max = min;
67+
for ( i = 1; i < N; i++ ) {
68+
ix += strideX;
69+
v = data[ix]; // Direct access
70+
if ( isnan( v ) ) {
71+
return v;
72+
}
73+
if ( v < min ) {
74+
min = v;
75+
} else if ( v > max ) {
76+
max = v;
77+
}
78+
}
79+
return max - min;
8080
}
8181

8282
// EXPORTS //
8383

84-
module.exports = range;
84+
module.exports = range;

lib/node_modules/@stdlib/stats/base/range/test/test.ndarray.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,4 @@ tape( 'the function supports an `offset` parameter (accessor)', function test( t
305305
t.ok(isnan(v), 'returns expected value');
306306

307307
t.end();
308-
});
308+
});

lib/node_modules/@stdlib/stats/base/range/test/test.range.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ tape( 'the function calculates the range of a strided array', function test( t )
6969
});
7070

7171
tape( 'the function calculates the range value of a sorted strided array (accessor)', function test( t ) {
72-
function accessor( arr, idx ) {
73-
return arr.get( idx );
74-
}
72+
function accessor( arr, idx ) {
73+
return arr.get( idx );
74+
}
7575

76-
var x = toAccessorArray( new Float64Array( [ -5.0, -2.0, 0.0, 1.0, 3.0, 5.0 ] ) );
77-
var v = range( x.length, x, accessor, 1 );
76+
var x = toAccessorArray( new Float64Array( [ -5.0, -2.0, 0.0, 1.0, 3.0, 5.0 ] ) );
77+
var v = range( x.length, x, accessor, 1 );
7878

79-
t.strictEqual(isnan(v), true, 'returns expected value');
80-
t.end();
79+
t.strictEqual(isnan(v), true, 'returns expected value');
80+
t.end();
8181
});
8282

8383

@@ -269,10 +269,10 @@ tape( 'the function supports view offsets (accessor)', function test( t ) {
269269
6.0
270270
]);
271271

272-
x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
272+
x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
273273

274274
v = range( 4, toAccessorArray( x1 ), 2 );
275275
t.strictEqual(isnan(v), true, 'returns expected value');
276276

277277
t.end();
278-
});
278+
});

0 commit comments

Comments
 (0)