Skip to content

Commit 7341676

Browse files
chore: fix JavaScript lint errors (issue #10184)
1 parent 0a3bfa2 commit 7341676

1 file changed

Lines changed: 88 additions & 84 deletions

File tree

  • lib/node_modules/@stdlib/math/strided/special/avercos-by/test

lib/node_modules/@stdlib/math/strided/special/avercos-by/test/test.main.js

Lines changed: 88 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@
2020

2121
// MODULES //
2222

23-
var tape = require( 'tape' );
24-
var avercos = require( '@stdlib/math/base/special/avercos' );
25-
var uniform = require( '@stdlib/random/base/uniform' ).factory;
26-
var Float64Array = require( '@stdlib/array/float64' );
27-
var avercosBy = require( './../lib/main.js' );
23+
var tape = require('tape');
24+
var avercos = require('@stdlib/math/base/special/avercos');
25+
var uniform = require('@stdlib/random/base/uniform').factory;
26+
var Float64Array = require('@stdlib/array/float64');
27+
var avercosBy = require('./../lib/main.js');
2828

2929

3030
// VARIABLES //
3131

32-
var rand = uniform( -2.0, 0.0 );
32+
var rand = uniform(-2.0, 0.0);
3333

3434

3535
// FUNCTIONS //
3636

37-
function accessor( v ) {
38-
if ( v === void 0 ) {
37+
function accessor(v) {
38+
if (v === void 0) {
3939
return;
4040
}
4141
return v;
@@ -44,18 +44,18 @@ function accessor( v ) {
4444

4545
// TESTS //
4646

47-
tape( 'main export is a function', function test( t ) {
48-
t.ok( true, __filename );
49-
t.strictEqual( typeof avercosBy, 'function', 'main export is a function' );
47+
tape('main export is a function', function test(t) {
48+
t.ok(true, __filename);
49+
t.strictEqual(typeof avercosBy, 'function', 'main export is a function');
5050
t.end();
5151
});
5252

53-
tape( 'the function has an arity of 7', function test( t ) {
54-
t.strictEqual( avercosBy.length, 7, 'arity of 7' );
53+
tape('the function has an arity of 7', function test(t) {
54+
t.strictEqual(avercosBy.length, 7, 'arity of 7');
5555
t.end();
5656
});
5757

58-
tape( 'the function computes the inverse versed cosine via a callback function', function test( t ) {
58+
tape('the function computes the inverse versed cosine via a callback function', function test(t) {
5959
var expected;
6060
var x;
6161
var y;
@@ -65,39 +65,43 @@ tape( 'the function computes the inverse versed cosine via a callback function',
6565
y = [];
6666

6767
expected = [];
68-
for ( i = 0; i < 10; i++ ) {
69-
x.push( rand() );
70-
y.push( 0.0 );
71-
expected.push( avercos( x[ i ] ) );
68+
for (i = 0; i < 10; i++) {
69+
x.push(rand());
70+
y.push(0.0);
71+
expected.push(avercos(x[i]));
7272
}
7373

74-
avercosBy( x.length, x, 1, y, 1, accessor );
75-
t.deepEqual( y, expected, 'deep equal' );
74+
avercosBy(x.length, x, 1, y, 1, accessor);
75+
t.deepEqual(y, expected, 'deep equal');
7676

77-
// eslint-disable-next-line stdlib/no-new-array
78-
x = new Array( 5 ); // sparse array
79-
y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
77+
78+
x = [];
79+
x.length = 5; // sparse array
80+
y = [0.0, 0.0, 0.0, 0.0, 0.0];
81+
82+
expected = [0.0, 0.0, 0.0, 0.0, 0.0];
8083

81-
expected = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
8284

83-
avercosBy( x.length, x, 1, y, 1, accessor );
84-
t.deepEqual( y, expected, 'deep equal' );
85+
avercosBy(x.length, x, 1, y, 1, accessor);
86+
t.deepEqual(y, expected, 'deep equal');
8587

86-
// eslint-disable-next-line stdlib/no-new-array
87-
x = new Array( 5 ); // sparse array
88-
x[ 2 ] = rand();
89-
y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
88+
89+
x = [];
90+
x.length = 5; // sparse array
91+
x[2] = rand();
92+
y = [0.0, 0.0, 0.0, 0.0, 0.0];
9093

9194
expected = y.slice();
92-
expected[ 2 ] = avercos( x[ 2 ] );
95+
expected[2] = avercos(x[2]);
96+
9397

94-
avercosBy( x.length, x, 1, y, 1, accessor );
95-
t.deepEqual( y, expected, 'deep equal' );
98+
avercosBy(x.length, x, 1, y, 1, accessor);
99+
t.deepEqual(y, expected, 'deep equal');
96100

97101
t.end();
98102
});
99103

100-
tape( 'the function supports an `x` stride', function test( t ) {
104+
tape('the function supports an `x` stride', function test(t) {
101105
var expected;
102106
var x;
103107
var y;
@@ -119,21 +123,21 @@ tape( 'the function supports an `x` stride', function test( t ) {
119123
];
120124
N = 3;
121125

122-
avercosBy( N, x, 2, y, 1, accessor );
126+
avercosBy(N, x, 2, y, 1, accessor);
123127

124128
expected = [
125-
avercos( x[ 0 ] ),
126-
avercos( x[ 2 ] ),
127-
avercos( x[ 4 ] ),
129+
avercos(x[0]),
130+
avercos(x[2]),
131+
avercos(x[4]),
128132
0.0,
129133
0.0
130134
];
131135

132-
t.deepEqual( y, expected, 'deep equal' );
136+
t.deepEqual(y, expected, 'deep equal');
133137
t.end();
134138
});
135139

136-
tape( 'the function supports a `y` stride', function test( t ) {
140+
tape('the function supports a `y` stride', function test(t) {
137141
var expected;
138142
var x;
139143
var y;
@@ -155,54 +159,54 @@ tape( 'the function supports a `y` stride', function test( t ) {
155159
];
156160
N = 3;
157161

158-
avercosBy( N, x, 1, y, 2, accessor );
162+
avercosBy(N, x, 1, y, 2, accessor);
159163

160164
expected = [
161-
avercos( x[ 0 ] ),
165+
avercos(x[0]),
162166
0.0,
163-
avercos( x[ 1 ] ),
167+
avercos(x[1]),
164168
0.0,
165-
avercos( x[ 2 ] )
169+
avercos(x[2])
166170
];
167171

168-
t.deepEqual( y, expected, 'deep equal' );
172+
t.deepEqual(y, expected, 'deep equal');
169173
t.end();
170174
});
171175

172-
tape( 'the function returns a reference to the destination array', function test( t ) {
176+
tape('the function returns a reference to the destination array', function test(t) {
173177
var out;
174178
var x;
175179
var y;
176180

177-
x = [ rand(), rand(), rand(), rand(), rand() ];
178-
y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
181+
x = [rand(), rand(), rand(), rand(), rand()];
182+
y = [0.0, 0.0, 0.0, 0.0, 0.0];
179183

180-
out = avercosBy( x.length, x, 1, y, 1, accessor );
184+
out = avercosBy(x.length, x, 1, y, 1, accessor);
181185

182-
t.strictEqual( out, y, 'same reference' );
186+
t.strictEqual(out, y, 'same reference');
183187
t.end();
184188
});
185189

186-
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) {
190+
tape('if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test(t) {
187191
var expected;
188192
var x;
189193
var y;
190194

191-
x = [ rand(), rand(), rand(), rand(), rand() ];
192-
y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
195+
x = [rand(), rand(), rand(), rand(), rand()];
196+
y = [0.0, 0.0, 0.0, 0.0, 0.0];
193197

194-
expected = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
198+
expected = [0.0, 0.0, 0.0, 0.0, 0.0];
195199

196-
avercosBy( -1, x, 1, y, 1, accessor );
197-
t.deepEqual( y, expected, 'returns `y` unchanged' );
200+
avercosBy(-1, x, 1, y, 1, accessor);
201+
t.deepEqual(y, expected, 'returns `y` unchanged');
198202

199-
avercosBy( 0, x, 1, y, 1, accessor );
200-
t.deepEqual( y, expected, 'returns `y` unchanged' );
203+
avercosBy(0, x, 1, y, 1, accessor);
204+
t.deepEqual(y, expected, 'returns `y` unchanged');
201205

202206
t.end();
203207
});
204208

205-
tape( 'the function supports negative strides', function test( t ) {
209+
tape('the function supports negative strides', function test(t) {
206210
var expected;
207211
var x;
208212
var y;
@@ -224,21 +228,21 @@ tape( 'the function supports negative strides', function test( t ) {
224228
];
225229
N = 3;
226230

227-
avercosBy( N, x, -2, y, -1, accessor );
231+
avercosBy(N, x, -2, y, -1, accessor);
228232

229233
expected = [
230-
avercos( x[ 0 ] ),
231-
avercos( x[ 2 ] ),
232-
avercos( x[ 4 ] ),
234+
avercos(x[0]),
235+
avercos(x[2]),
236+
avercos(x[4]),
233237
0.0,
234238
0.0
235239
];
236240

237-
t.deepEqual( y, expected, 'deep equal' );
241+
t.deepEqual(y, expected, 'deep equal');
238242
t.end();
239243
});
240244

241-
tape( 'the function supports complex access patterns', function test( t ) {
245+
tape('the function supports complex access patterns', function test(t) {
242246
var expected;
243247
var x;
244248
var y;
@@ -262,22 +266,22 @@ tape( 'the function supports complex access patterns', function test( t ) {
262266
];
263267
N = 3;
264268

265-
avercosBy( N, x, 2, y, -1, accessor );
269+
avercosBy(N, x, 2, y, -1, accessor);
266270

267271
expected = [
268-
avercos( x[ 4 ] ),
269-
avercos( x[ 2 ] ),
270-
avercos( x[ 0 ] ),
272+
avercos(x[4]),
273+
avercos(x[2]),
274+
avercos(x[0]),
271275
0.0,
272276
0.0,
273277
0.0
274278
];
275279

276-
t.deepEqual( y, expected, 'deep equal' );
280+
t.deepEqual(y, expected, 'deep equal');
277281
t.end();
278282
});
279283

280-
tape( 'the function supports view offsets', function test( t ) {
284+
tape('the function supports view offsets', function test(t) {
281285
var expected;
282286
var x0;
283287
var y0;
@@ -304,41 +308,41 @@ tape( 'the function supports view offsets', function test( t ) {
304308
]);
305309

306310
// Create offset views...
307-
x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element
308-
y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element
311+
x1 = new Float64Array(x0.buffer, x0.BYTES_PER_ELEMENT * 1); // begin at 2nd element
312+
y1 = new Float64Array(y0.buffer, y0.BYTES_PER_ELEMENT * 3); // begin at the 4th element
309313

310314
N = 3;
311315

312-
avercosBy( N, x1, -2, y1, 1, accessor );
316+
avercosBy(N, x1, -2, y1, 1, accessor);
313317
expected = new Float64Array([
314318
0.0,
315319
0.0,
316320
0.0,
317-
avercos( x0[ 5 ] ),
318-
avercos( x0[ 3 ] ),
319-
avercos( x0[ 1 ] )
321+
avercos(x0[5]),
322+
avercos(x0[3]),
323+
avercos(x0[1])
320324
]);
321325

322-
t.deepEqual( y0, expected, 'deep equal' );
326+
t.deepEqual(y0, expected, 'deep equal');
323327
t.end();
324328
});
325329

326-
tape( 'the function supports providing a callback execution context', function test( t ) {
330+
tape('the function supports providing a callback execution context', function test(t) {
327331
var ctx;
328332
var x;
329333
var y;
330334

331-
x = [ rand(), rand(), rand(), rand(), rand() ];
332-
y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
335+
x = [rand(), rand(), rand(), rand(), rand()];
336+
y = [0.0, 0.0, 0.0, 0.0, 0.0];
333337
ctx = {
334338
'count': 0
335339
};
336-
avercosBy( x.length, x, 1, y, 1, accessor, ctx );
340+
avercosBy(x.length, x, 1, y, 1, accessor, ctx);
337341

338-
t.strictEqual( ctx.count, x.length, 'returns expected value' );
342+
t.strictEqual(ctx.count, x.length, 'returns expected value');
339343
t.end();
340344

341-
function accessor( v ) {
345+
function accessor(v) {
342346
this.count += 1; // eslint-disable-line no-invalid-this
343347
return v;
344348
}

0 commit comments

Comments
 (0)