11/**
22* @license Apache-2.0
33*
4- * Copyright (c) 2025 The Stdlib Authors.
4+ * Copyright (c) 2020 The Stdlib Authors.
55*
66* Licensed under the Apache License, Version 2.0 (the "License");
77* you may not use this file except in compliance with the License.
2121// MODULES //
2222
2323var tape = require ( 'tape' ) ;
24- var floor = require ( '@stdlib/math/base/special/floor' ) ;
25- var toAccessorArray = require ( '@stdlib/array/base/to-accessor-array' ) ;
2624var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
2725var isNegativeZero = require ( '@stdlib/math/base/assert/is-negative-zero' ) ;
26+ var toAccessorArray = require ( '@stdlib/array/base/to-accessor-array' ) ;
2827var Float64Array = require ( '@stdlib/array/float64' ) ;
29- var nanminBy = require ( './../lib/nanmin_by .js' ) ;
28+ var nanminBy = require ( './../lib/main .js' ) ;
3029
3130
3231// FUNCTIONS //
@@ -76,11 +75,11 @@ tape( 'the function calculates the minimum value of a strided array via a callba
7675 v = nanminBy ( x . length , x , 1 , accessor ) ;
7776 t . strictEqual ( isnan ( v ) , true , 'returns expected value' ) ;
7877
79- x = new Array ( 5 ) ; // sparse array
78+ x = new Array ( 5 ) ; // eslint-disable-line stdlib/no-new- array
8079 v = nanminBy ( x . length , x , 1 , accessor ) ;
8180 t . strictEqual ( isnan ( v ) , true , 'returns expected value' ) ;
8281
83- x = new Array ( 5 ) ; // sparse array
82+ x = new Array ( 5 ) ; // eslint-disable-line stdlib/no-new- array
8483 x [ 2 ] = 1.0 ;
8584 v = nanminBy ( x . length , x , 1 , accessor ) ;
8685 t . strictEqual ( v , 2.0 , 'returns expected value' ) ;
@@ -112,13 +111,13 @@ tape( 'the function calculates the minimum value of a strided array via a callba
112111 v = nanminBy ( x . length , toAccessorArray ( x ) , 1 , accessor ) ;
113112 t . strictEqual ( isnan ( v ) , true , 'returns expected value' ) ;
114113
115- x = new Array ( 5 ) ; // sparse array
114+ x = new Array ( 5 ) ; // eslint-disable-line stdlib/no-new- array
116115 v = nanminBy ( x . length , toAccessorArray ( x ) , 1 , accessor ) ;
117116 t . strictEqual ( isnan ( v ) , true , 'returns expected value' ) ;
118117
119- x = new Array ( 5 ) ; // sparse array
118+ x = new Array ( 5 ) ; // eslint-disable-line stdlib/no-new- array
120119 x [ 2 ] = 1.0 ;
121- v = nanminBy ( x . length , toAccessorArray ( x ) , 1 , accessor ) ;
120+ v = nanminBy ( x . length , toAccessorArray ( x ) , 1 , accessor ) ;
122121 t . strictEqual ( v , 2.0 , 'returns expected value' ) ;
123122
124123 t . end ( ) ;
@@ -148,7 +147,7 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu
148147 v = nanminBy ( 0 , toAccessorArray ( x ) , 1 , accessor ) ;
149148 t . strictEqual ( isnan ( v ) , true , 'returns expected value' ) ;
150149
151- v = nanminBy ( - 1 , x , 1 , accessor ) ;
150+ v = nanminBy ( - 1 , toAccessorArray ( x ) , 1 , accessor ) ;
152151 t . strictEqual ( isnan ( v ) , true , 'returns expected value' ) ;
153152
154153 t . end ( ) ;
@@ -163,7 +162,7 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first
163162 v = nanminBy ( 1 , x , 1 , accessor ) ;
164163 t . strictEqual ( v , 2.0 , 'returns expected value' ) ;
165164
166- x = new Array ( 1 ) ; // sparse array
165+ x = new Array ( 1 ) ; // eslint-disable-line stdlib/no-new- array
167166 v = nanminBy ( 1 , x , 1 , accessor ) ;
168167 t . strictEqual ( isnan ( v ) , true , 'returns expected value' ) ;
169168
@@ -179,15 +178,14 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first
179178 v = nanminBy ( 1 , toAccessorArray ( x ) , 1 , accessor ) ;
180179 t . strictEqual ( v , 2.0 , 'returns expected value' ) ;
181180
182- x = new Array ( 1 ) ; // sparse array
181+ x = new Array ( 1 ) ; // eslint-disable-line stdlib/no-new- array
183182 v = nanminBy ( 1 , toAccessorArray ( x ) , 1 , accessor ) ;
184183 t . strictEqual ( isnan ( v ) , true , 'returns expected value' ) ;
185184
186185 t . end ( ) ;
187186} ) ;
188187
189188tape ( 'the function supports a `stride` parameter' , function test ( t ) {
190- var N ;
191189 var x ;
192190 var v ;
193191
@@ -204,15 +202,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
204202 NaN
205203 ] ;
206204
207- N = floor ( x . length / 2 ) ;
208- v = nanminBy ( N , x , 2 , accessor ) ;
205+ v = nanminBy ( 5 , x , 2 , accessor ) ;
209206
210207 t . strictEqual ( v , - 4.0 , 'returns expected value' ) ;
211208 t . end ( ) ;
212209} ) ;
213210
214211tape ( 'the function supports a `stride` parameter (accessors)' , function test ( t ) {
215- var N ;
216212 var x ;
217213 var v ;
218214
@@ -229,15 +225,13 @@ tape( 'the function supports a `stride` parameter (accessors)', function test( t
229225 NaN
230226 ] ;
231227
232- N = floor ( x . length / 2 ) ;
233- v = nanminBy ( N , toAccessorArray ( x ) , 2 , accessor ) ;
228+ v = nanminBy ( 5 , toAccessorArray ( x ) , 2 , accessor ) ;
234229
235230 t . strictEqual ( v , - 4.0 , 'returns expected value' ) ;
236231 t . end ( ) ;
237232} ) ;
238233
239234tape ( 'the function supports a negative `stride` parameter' , function test ( t ) {
240- var N ;
241235 var x ;
242236 var v ;
243237
@@ -254,15 +248,13 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
254248 2.0
255249 ] ;
256250
257- N = floor ( x . length / 2 ) ;
258- v = nanminBy ( N , x , - 2 , accessor ) ;
251+ v = nanminBy ( 5 , x , - 2 , accessor ) ;
259252
260253 t . strictEqual ( v , - 4.0 , 'returns expected value' ) ;
261254 t . end ( ) ;
262255} ) ;
263256
264257tape ( 'the function supports a negative `stride` parameter (accessors)' , function test ( t ) {
265- var N ;
266258 var x ;
267259 var v ;
268260
@@ -279,8 +271,7 @@ tape( 'the function supports a negative `stride` parameter (accessors)', functio
279271 2.0
280272 ] ;
281273
282- N = floor ( x . length / 2 ) ;
283- v = nanminBy ( N , toAccessorArray ( x ) , - 2 , accessor ) ;
274+ v = nanminBy ( 5 , toAccessorArray ( x ) , - 2 , accessor ) ;
284275
285276 t . strictEqual ( v , - 4.0 , 'returns expected value' ) ;
286277 t . end ( ) ;
@@ -295,7 +286,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the f
295286 v = nanminBy ( x . length , x , 0 , accessor ) ;
296287 t . strictEqual ( v , 2.0 , 'returns expected value' ) ;
297288
298- x = new Array ( 1 ) ; // sparse array
289+ x = new Array ( 1 ) ; // eslint-disable-line stdlib/no-new- array
299290 v = nanminBy ( 1 , x , 0 , accessor ) ;
300291 t . strictEqual ( isnan ( v ) , true , 'returns expected value' ) ;
301292
@@ -311,7 +302,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the f
311302 v = nanminBy ( x . length , toAccessorArray ( x ) , 0 , accessor ) ;
312303 t . strictEqual ( v , 2.0 , 'returns expected value' ) ;
313304
314- x = new Array ( 1 ) ; // sparse array
305+ x = new Array ( 1 ) ; // eslint-disable-line stdlib/no-new- array
315306 v = nanminBy ( 1 , toAccessorArray ( x ) , 0 , accessor ) ;
316307 t . strictEqual ( isnan ( v ) , true , 'returns expected value' ) ;
317308
@@ -321,7 +312,6 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the f
321312tape ( 'the function supports view offsets' , function test ( t ) {
322313 var x0 ;
323314 var x1 ;
324- var N ;
325315 var v ;
326316
327317 x0 = new Float64Array ( [
@@ -339,9 +329,8 @@ tape( 'the function supports view offsets', function test( t ) {
339329 ] ) ;
340330
341331 x1 = new Float64Array ( x0 . buffer , x0 . BYTES_PER_ELEMENT * 1 ) ; // start at 2nd element
342- N = floor ( x1 . length / 2 ) ;
343332
344- v = nanminBy ( N , x1 , 2 , accessor ) ;
333+ v = nanminBy ( 5 , x1 , 2 , accessor ) ;
345334 t . strictEqual ( v , - 4.0 , 'returns expected value' ) ;
346335
347336 t . end ( ) ;
@@ -350,7 +339,6 @@ tape( 'the function supports view offsets', function test( t ) {
350339tape ( 'the function supports view offsets (accessors)' , function test ( t ) {
351340 var x0 ;
352341 var x1 ;
353- var N ;
354342 var v ;
355343
356344 x0 = new Float64Array ( [
@@ -368,9 +356,8 @@ tape( 'the function supports view offsets (accessors)', function test( t ) {
368356 ] ) ;
369357
370358 x1 = new Float64Array ( x0 . buffer , x0 . BYTES_PER_ELEMENT * 1 ) ; // start at 2nd element
371- N = floor ( x1 . length / 2 ) ;
372359
373- v = nanminBy ( N , toAccessorArray ( x1 ) , 2 , accessor ) ;
360+ v = nanminBy ( 5 , toAccessorArray ( x1 ) , 2 , accessor ) ;
374361 t . strictEqual ( v , - 4.0 , 'returns expected value' ) ;
375362
376363 t . end ( ) ;
0 commit comments