Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions lib/node_modules/@stdlib/array/uint64/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ arr.set( 2, 1 );
arr.set( 9, 9 );

// Get the first element:
var z = arr.at( 0 );
var u = arr.at( 0 );
// returns <Uint64>[ 1n ]

// Get the last element:
z = arr.at( -1 );
u = arr.at( -1 );
// returns <Uint64>[ 9n ]
```

Expand All @@ -271,10 +271,10 @@ If provided an out-of-bounds index, the method returns `undefined`.
```javascript
var arr = new Uint64Array( 10 );

var z = arr.at( 100 );
var u = arr.at( 100 );
// returns undefined

z = arr.at( -100 );
u = arr.at( -100 );
// returns undefined
```

Expand All @@ -287,12 +287,7 @@ Returns an iterator for iterating over array key-value pairs.
```javascript
var Uint64 = require( '@stdlib/number/uint64/ctor' );

var arr = [
new Uint64( 1 ),
new Uint64( 2 ),
new Uint64( 3 )
];
arr = new Uint64Array( arr );
var arr = new Uint64Array( [ 1, 2, 3 ] );

// Create an iterator:
var it = arr.entries();
Expand Down Expand Up @@ -329,7 +324,7 @@ var arr = new Uint64Array( 10 );
arr.set( 1, 0 );

// Get the first element:
var z = arr.get( 0 );
var u = arr.get( 0 );
// returns <Uint64>[ 1n ]
```

Expand All @@ -338,7 +333,7 @@ If provided an out-of-bounds index, the method returns `undefined`.
```javascript
var arr = new Uint64Array( 10 );

var z = arr.get( 100 );
var u = arr.get( 100 );
// returns undefined
```

Expand All @@ -355,14 +350,14 @@ var arr = new Uint64Array( [ 1, 2, 3 ] );
// returns <Uint64Array>[ 1n, 2n, 3n ]

// Get the first element:
var z = arr.get( 0 );
var u = arr.get( 0 );
// returns <Uint64>[ 1n ]

// Set the first element:
arr.set( new Uint64( 5 ) );

// Get the first element:
z = arr.get( 0 );
u = arr.get( 0 );
// returns <Uint64>[ 5n ]
```

Expand All @@ -375,14 +370,14 @@ var arr = new Uint64Array( [ 1, 2, 3 ] );
// returns <Uint64Array>[ 1n, 2n, 3n ]

// Get the third element:
var z = arr.get( 2 );
var u = arr.get( 2 );
// returns <Uint64>[ 3n ]

// Set the third element:
arr.set( new Uint64( 5 ), 2 );

// Get the third element:
z = arr.get( 2 );
u = arr.get( 2 );
// returns <Uint64>[ 5n ]
```

Expand All @@ -397,10 +392,10 @@ var arr = new Uint64Array( [ 1, 2, 3 ] );
// Set the first two array elements:
arr.set( [ 4, 5 ] );

var z = arr.get( 0 );
var u = arr.get( 0 );
// returns <Uint64>[ 4n ]

z = arr.get( 1 );
u = arr.get( 1 );
// returns <Uint64>[ 5n ]
```

Expand Down
10 changes: 5 additions & 5 deletions lib/node_modules/@stdlib/array/uint64/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
--------
> var arr = new {{alias}}( [ 1, 2 ] )
<Uint64Array>[ 1n, 2n ]
> var z = arr.at( 1 )
> var u = arr.at( 1 )
<Uint64>[ 2n ]


Expand Down Expand Up @@ -295,7 +295,7 @@
--------
> var arr = new {{alias}}( [ 1, 2 ] )
<Uint64Array>[ 1n, 2n ]
> var z = arr.get( 1 )
> var u = arr.get( 1 )
<Uint64>[ 2n ]


Expand All @@ -320,12 +320,12 @@
--------
> var arr = new {{alias}}( [ 1, 2, 3 ] );
> arr.set( new {{alias:@stdlib/number/uint64/ctor}}( 4 ), 1 );
> var z = arr.get( 1 )
> var u = arr.get( 1 )
<Uint64>[ 4n ]
> arr.set( [ 5, 6 ], 1 );
> z = arr.get( 1 )
> u = arr.get( 1 )
<Uint64>[ 5n ]
> z = arr.get( 2 )
> u = arr.get( 2 )
<Uint64>[ 6n ]

See Also
Expand Down
17 changes: 6 additions & 11 deletions lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import ArrayBuffer = require( '@stdlib/array/buffer' );

// Define a union type representing both iterable and non-iterable iterators:
type Iterator = Iter | IterableIterator;

Check failure on line 31 in lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'Iterator' is defined but never used

// Define a type representing a value from which a 64-bit unsigned integer can be derived:
type Uint = Uint64 | bigint | number;
Expand All @@ -36,7 +36,7 @@
/**
* Locale-specific configuration options.
*/
interface LocaleOptions<T = unknown> {

Check failure on line 39 in lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'LocaleOptions' is defined but never used
/**
* Configuration property.
*/
Expand Down Expand Up @@ -118,7 +118,7 @@
* @param arr - array on which the method was called
* @returns boolean indicating whether an element in an array passes a test
*/
type Predicate<U> = NullaryPredicate<U> | UnaryPredicate<U> | BinaryPredicate<U> | TernaryPredicate<U>;

Check failure on line 121 in lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'Predicate' is defined but never used

/**
* Callback invoked for each element in an array.
Expand Down Expand Up @@ -162,7 +162,7 @@
* @param arr - array on which the method was called
* @returns undefined
*/
type Callback<U> = NullaryCallback<U> | UnaryCallback<U> | BinaryCallback<U> | TernaryCallback<U>;

Check failure on line 165 in lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'Callback' is defined but never used

/**
* Callback invoked for each element in an array.
Expand Down Expand Up @@ -206,7 +206,7 @@
* @param arr - array on which the method was called
* @returns transformed value
*/
type MapFcn<U> = NullaryMapFcn<U> | UnaryMapFcn<U> | BinaryMapFcn<U> | TernaryMapFcn<U>;

Check failure on line 209 in lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'MapFcn' is defined but never used

/**
* Reducer function invoked for each element in an array.
Expand Down Expand Up @@ -260,7 +260,7 @@
* @param arr - array on which the method was called
* @returns accumulated result
*/
type Reducer<U> = NullaryReducer<U> | UnaryReducer<U> | BinaryReducer<U> | TernaryReducer<U> | QuaternaryReducer<U>;

Check failure on line 263 in lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'Reducer' is defined but never used

/**
* Comparator function.
Expand All @@ -269,7 +269,7 @@
* @param b - second value for comparison
* @returns number indicating comparison result
*/
type CompareFcn = ( a: Uint64, b: Uint64 ) => number;

Check failure on line 272 in lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'CompareFcn' is defined but never used

/**
* Class for creating a 64-bit unsigned integer array.
Expand Down Expand Up @@ -434,12 +434,7 @@
* @example
* var Uint64 = require( '@stdlib/number/uint64/ctor' );
*
* var arr = [
* new Uint64( 1 ),
* new Uint64( 2 ),
* new Uint64( 3 )
* ];
* arr = new Uint64Array( arr );
* var arr = new Uint64Array( [ 1, 2, 3 ] );
*
* // Create an iterator:
* var it = arr.entries();
Expand Down Expand Up @@ -469,15 +464,15 @@
* @example
* var arr = new Uint64Array( 10 );
*
* var z = arr.get( 0 );
* var u = arr.get( 0 );
* // returns <Uint64>[ 0n ]
*
* arr.set( 1, 0 );
*
* var z = arr.get( 0 );
* u = arr.get( 0 );
* // returns <Uint64>[ 1n ]
*
* z = arr.get( 100 );
* u = arr.get( 100 );
* // returns undefined
*/
get( i: number ): Uint64 | void;
Expand Down Expand Up @@ -516,12 +511,12 @@
* @example
* var arr = new Uint64Array( 10 );
*
* var z = arr.get( 0 );
* var u = arr.get( 0 );
* // returns <Uint64>[ 0n ]
*
* arr.set( 1, 0 );
*
* z = arr.get( 0 );
* u = arr.get( 0 );
* // returns <Uint64>[ 1n ]
*/
set( value: ArrayLike<Uint> | Uint64Array | Uint, i?: number ): void;
Expand Down
13 changes: 4 additions & 9 deletions lib/node_modules/@stdlib/array/uint64/lib/from_array.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@

// MODULES //

var isUint64 = require( '@stdlib/assert/is-uint64' );
var toWords = require( '@stdlib/number/uint64/base/to-words' ).assign;
var Uint64 = require( '@stdlib/number/uint64/ctor' );
var format = require( '@stdlib/string/format' );
var indices = require( './indices.js' );
var scalarToUint64 = require( './scalar_to_uint64.js' );


// MAIN //
Expand All @@ -50,13 +49,9 @@ function fromArray( buf, arr ) {
len = arr.length;
j = 0;
for ( i = 0; i < len; i++ ) {
v = arr[ i ];
if ( !isUint64( v ) ) {
try {
v = new Uint64( v );
} catch ( err ) { // eslint-disable-line no-unused-vars
return new TypeError( format( 'invalid argument. An array element must be either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', v ) );
}
v = scalarToUint64( arr[ i ] );
if ( v instanceof Error ) {
return new TypeError( format( 'invalid argument. An array element must be either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', arr[ i ] ) );
}
toWords( v, words, 1, 0 );
buf[ j+indices.HIGH ] = words[ 0 ];
Expand Down
13 changes: 4 additions & 9 deletions lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

// MODULES //

var isUint64 = require( '@stdlib/assert/is-uint64' );
var toWords = require( '@stdlib/number/uint64/base/to-words' ).assign;
var Uint64 = require( '@stdlib/number/uint64/ctor' );
var format = require( '@stdlib/string/format' );
var scalarToUint64 = require( './scalar_to_uint64.js' );


// MAIN //
Expand All @@ -50,13 +49,9 @@ function fromIterator( it ) {
if ( v.done ) {
break;
}
u = v.value;
if ( !isUint64( u ) ) {
try {
u = new Uint64( u );
} catch ( err ) { // eslint-disable-line no-unused-vars
return new TypeError( format( 'invalid argument. An iterator must return either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', u ) );
}
u = scalarToUint64( v.value );
if ( u instanceof Error ) {
return new TypeError( format( 'invalid argument. An iterator must return either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', v.value ) );
}
toWords( u, words, 1, 0 );
out.push( words[ 0 ], words[ 1 ] );
Expand Down
15 changes: 6 additions & 9 deletions lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

// MODULES //

var isUint64 = require( '@stdlib/assert/is-uint64' );
var toWords = require( '@stdlib/number/uint64/base/to-words' ).assign;
var Uint64 = require( '@stdlib/number/uint64/ctor' );
var format = require( '@stdlib/string/format' );
var scalarToUint64 = require( './scalar_to_uint64.js' );


// MAIN //
Expand All @@ -42,6 +41,7 @@ function fromIteratorMap( it, clbk, thisArg ) {
var out;
var v;
var u;
var r;
var i;

// Workspace for storing high and low words:
Expand All @@ -55,13 +55,10 @@ function fromIteratorMap( it, clbk, thisArg ) {
break;
}
i += 1;
u = clbk.call( thisArg, v.value, i );
if ( !isUint64( u ) ) {
try {
u = new Uint64( u );
} catch ( err ) { // eslint-disable-line no-unused-vars
return new TypeError( format( 'invalid argument. An iterator must return either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', u ) );
}
r = clbk.call( thisArg, v.value, i );
u = scalarToUint64( r );
if ( u instanceof Error ) {
return new TypeError( format( 'invalid argument. An iterator must return either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', r ) );
}
toWords( u, words, 1, 0 );
out.push( words[ 0 ], words[ 1 ] );
Expand Down
39 changes: 14 additions & 25 deletions lib/node_modules/@stdlib/array/uint64/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
var fromIterator = require( './from_iterator.js' );
var fromIteratorMap = require( './from_iterator_map.js' );
var fromArray = require( './from_array.js' );
var scalarToUint64 = require( './scalar_to_uint64.js' );


// VARIABLES //
Expand Down Expand Up @@ -403,13 +404,10 @@
words = [ 0, 0 ];
j = 0;
for ( i = 0; i < len; i++ ) {
v = clbk.call( thisArg, get( src, i ), i );
if ( !isUint64( v ) ) {
try {
v = new Uint64( v );
} catch ( err ) { // eslint-disable-line no-unused-vars
throw new TypeError( format( 'invalid argument. A callback must return either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', v ) );
}
tmp = clbk.call( thisArg, get( src, i ), i );
v = scalarToUint64( tmp );
if ( v instanceof Error ) {
throw new TypeError( format( 'invalid argument. A callback must return either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', tmp ) );
}
toWords( v, words, 1, 0 );
buf[ j+indices.HIGH ] = words[ 0 ];
Expand Down Expand Up @@ -611,12 +609,7 @@
* @example
* var Uint64 = require( '@stdlib/number/uint64/ctor' );
*
* var arr = [
* new Uint64( 1 ),
* new Uint64( 2 ),
* new Uint64( 3 )
* ];
* arr = new Uint64Array( arr );
* var arr = new Uint64Array( [ 1, 2, 3 ] );
*
* // Create an iterator:
* var it = arr.entries();
Expand Down Expand Up @@ -725,15 +718,15 @@
* @example
* var arr = new Uint64Array( 10 );
*
* var z = arr.get( 0 );
* var u = arr.get( 0 );
* // returns <Uint64>[ 0n ]
*
* arr.set( [ 1 ], 0 );
*
* z = arr.get( 0 );
* u = arr.get( 0 );
* // returns <Uint64>[ 1n ]
*
* z = arr.get( 100 );
* u = arr.get( 100 );
* // returns undefined
*/
setReadOnly( Uint64Array.prototype, 'get', function get( idx ) {
Expand Down Expand Up @@ -806,12 +799,12 @@
* @example
* var arr = new Uint64Array( 10 );
*
* var z = arr.get( 0 );
* var u = arr.get( 0 );
* // returns <Uint64>[ 0n ]
*
* arr.set( 1n, 0 );
*
* z = arr.get( 0 );
* u = arr.get( 0 );
* // returns <Uint64>[ 1n ]
*/
setReadOnly( Uint64Array.prototype, 'set', function set( value ) {
Expand Down Expand Up @@ -848,7 +841,7 @@
buf[ idx+indices.LOW ] = words[ 1 ];
return;
}
if ( isNonNegativeInteger( value ) || ( isBigInt( value ) && isNonNegativeInteger( Number( value ) ) ) ) {

Check warning on line 844 in lib/node_modules/@stdlib/array/uint64/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

This line has a length of 110. Maximum allowed is 80
if ( idx >= this._length ) {
throw new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );
}
Expand Down Expand Up @@ -912,13 +905,9 @@
}
idx *= 2;
for ( i = 0; i < N; i++ ) {
v = sbuf[ i ];
if ( !isUint64( v ) ) {
try {
v = new Uint64( v );
} catch ( err ) { // eslint-disable-line no-unused-vars
throw new TypeError( format( 'invalid argument. An array element must be either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', v ) );
}
v = scalarToUint64( sbuf[ i ] );
if ( v instanceof Error ) {
throw new TypeError( format( 'invalid argument. An array element must be either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', sbuf[ i ] ) );
}
toWords( v, words, 1, 0 );
buf[ idx+indices.HIGH ] = words[ 0 ];
Expand Down
Loading
Loading