Skip to content

Commit dbed196

Browse files
committed
Use max array length constant
1 parent fcf66fb commit dbed196

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/node_modules/@stdlib/assert/is-array-length/lib/is_array_length.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// MODULES //
44

55
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' );
77

88

99
// MAIN //
@@ -26,7 +26,7 @@ function isArrayLength( value ) {
2626
return (
2727
isInteger( value ) &&
2828
value >= 0 &&
29-
value <= MAX_UINT32
29+
value <= MAX_ARRAY_LENGTH
3030
);
3131
} // end FUNCTION isArrayLength()
3232

lib/node_modules/@stdlib/assert/is-array-length/test/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// MODULES //
44

55
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' );
77
var isArrayLength = require( './../lib' );
88

99

@@ -18,12 +18,12 @@ tape( 'main export is a function', function test( t ) {
1818
tape( 'the function returns `true` if provided a valid array length', function test( t ) {
1919
t.strictEqual( isArrayLength( 0 ), true, 'returns true' );
2020
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' );
2222
t.end();
2323
});
2424

2525
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' );
2727
t.strictEqual( isArrayLength( -1 ), false, 'returns false' );
2828
t.strictEqual( isArrayLength( 3.14 ), false, 'returns false' );
2929
t.end();

0 commit comments

Comments
 (0)