File tree 2 files changed +5
-5
lines changed
lib/node_modules/@stdlib/assert/is-array-length
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 3
3
// MODULES //
4
4
5
5
var isInteger = require ( '@stdlib/assert/is-integer' ) . isPrimitive ;
6
- var MAX_UINT32 = require ( '@stdlib/math /constants/uint32- max' ) ;
6
+ var MAX_ARRAY_LENGTH = require ( '@stdlib/array /constants/max-array-length ' ) ;
7
7
8
8
9
9
// MAIN //
@@ -26,7 +26,7 @@ function isArrayLength( value ) {
26
26
return (
27
27
isInteger ( value ) &&
28
28
value >= 0 &&
29
- value <= MAX_UINT32
29
+ value <= MAX_ARRAY_LENGTH
30
30
) ;
31
31
} // end FUNCTION isArrayLength()
32
32
Original file line number Diff line number Diff line change 3
3
// MODULES //
4
4
5
5
var tape = require ( 'tape' ) ;
6
- var UINT32_MAX = require ( '@stdlib/math /constants/uint32- max' ) ;
6
+ var MAX_ARRAY_LENGTH = require ( '@stdlib/array /constants/max-array-length ' ) ;
7
7
var isArrayLength = require ( './../lib' ) ;
8
8
9
9
@@ -18,12 +18,12 @@ tape( 'main export is a function', function test( t ) {
18
18
tape ( 'the function returns `true` if provided a valid array length' , function test ( t ) {
19
19
t . strictEqual ( isArrayLength ( 0 ) , true , 'returns true' ) ;
20
20
t . strictEqual ( isArrayLength ( 10 ) , true , 'returns true' ) ;
21
- t . strictEqual ( isArrayLength ( UINT32_MAX ) , true , 'returns true' ) ;
21
+ t . strictEqual ( isArrayLength ( MAX_ARRAY_LENGTH ) , true , 'returns true' ) ;
22
22
t . end ( ) ;
23
23
} ) ;
24
24
25
25
tape ( 'the function returns `false` if not provided a valid array length' , function test ( t ) {
26
- t . strictEqual ( isArrayLength ( UINT32_MAX + 1 ) , false , 'returns false' ) ;
26
+ t . strictEqual ( isArrayLength ( MAX_ARRAY_LENGTH + 1 ) , false , 'returns false' ) ;
27
27
t . strictEqual ( isArrayLength ( - 1 ) , false , 'returns false' ) ;
28
28
t . strictEqual ( isArrayLength ( 3.14 ) , false , 'returns false' ) ;
29
29
t . end ( ) ;
You can’t perform that action at this time.
0 commit comments