From 5dd084a02cd54a2521704edec89f8df0a7e471db Mon Sep 17 00:00:00 2001 From: Divit Date: Fri, 21 Aug 2026 18:47:05 +0000 Subject: [PATCH 1/8] refactor: add scalarToUint64 --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../array/uint64/lib/scalar_to_uint64.js | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/uint64/lib/scalar_to_uint64.js diff --git a/lib/node_modules/@stdlib/array/uint64/lib/scalar_to_uint64.js b/lib/node_modules/@stdlib/array/uint64/lib/scalar_to_uint64.js new file mode 100644 index 000000000000..289944096191 --- /dev/null +++ b/lib/node_modules/@stdlib/array/uint64/lib/scalar_to_uint64.js @@ -0,0 +1,51 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isUint64 = require( '@stdlib/assert/is-uint64' ); +var Uint64 = require( '@stdlib/number/uint64/ctor' ); +var format = require( '@stdlib/string/format' ); + + +// MAIN // + +/** +* Converts a value to a 64-bit unsigned integer. +* +* @private +* @param {*} value - value to convert +* @returns {(Uint64|TypeError)} 64-bit unsigned integer or an error +*/ +function scalarToUint64( value ) { + if ( isUint64( value ) ) { + return value; + } + try { + return new Uint64( value ); + } catch ( err ) { // eslint-disable-line no-unused-vars + return new TypeError( format( 'invalid argument. Value must be either a 64-bit unsigned integer or a value which can be converted to a 64-bit unsigned integer. Value: `%s`.', value ) ); + } +} + + +// EXPORTS // + +module.exports = scalarToUint64; From 4cadcb6cb585b31c934cccd430c8551a345ed017 Mon Sep 17 00:00:00 2001 From: Divit Date: Fri, 21 Aug 2026 19:04:39 +0000 Subject: [PATCH 2/8] refactor: use scalarToUint64 --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/array/uint64/lib/from_array.js | 13 ++++-------- .../@stdlib/array/uint64/lib/from_iterator.js | 13 ++++-------- .../array/uint64/lib/from_iterator_map.js | 13 ++++-------- .../@stdlib/array/uint64/lib/main.js | 21 +++++++------------ 4 files changed, 19 insertions(+), 41 deletions(-) diff --git a/lib/node_modules/@stdlib/array/uint64/lib/from_array.js b/lib/node_modules/@stdlib/array/uint64/lib/from_array.js index 0486566e4ac7..65d4641fe4e6 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/from_array.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/from_array.js @@ -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 // @@ -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`.', v ) ); } toWords( v, words, 1, 0 ); buf[ j+indices.HIGH ] = words[ 0 ]; diff --git a/lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js b/lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js index 4e4ccb930231..cf83a138c7c5 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js @@ -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 // @@ -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`.', u ) ); } toWords( u, words, 1, 0 ); out.push( words[ 0 ], words[ 1 ] ); diff --git a/lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js b/lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js index 527fe5b936ad..54ca13b48ebb 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js @@ -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 // @@ -55,13 +54,9 @@ 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 ) ); - } + u = scalarToUint64( clbk.call( thisArg, v.value, i ) ); + 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`.', u ) ); } toWords( u, words, 1, 0 ); out.push( words[ 0 ], words[ 1 ] ); diff --git a/lib/node_modules/@stdlib/array/uint64/lib/main.js b/lib/node_modules/@stdlib/array/uint64/lib/main.js index e366fe395f55..031b576e9321 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/main.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/main.js @@ -45,6 +45,7 @@ var indices = require( './indices.js' ); 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 // @@ -401,13 +402,9 @@ setReadOnly( Uint64Array, 'from', function from( src ) { 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 ) ); - } + v = scalarToUint64( clbk.call( thisArg, get( src, i ), i ) ); + 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`.', v ) ); } toWords( v, words, 1, 0 ); buf[ j+indices.HIGH ] = words[ 0 ]; @@ -915,13 +912,9 @@ setReadOnly( Uint64Array.prototype, 'set', function set( value ) { } 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`.', v ) ); } toWords( v, words, 1, 0 ); buf[ idx+indices.HIGH ] = words[ 0 ]; From 75f9bf1646c4ff99f1d13b5f6761f1d6df2bee53 Mon Sep 17 00:00:00 2001 From: Divit Date: Fri, 21 Aug 2026 19:07:05 +0000 Subject: [PATCH 3/8] chore: replace z with u in examples --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/array/uint64/README.md | 24 +++++++++---------- .../@stdlib/array/uint64/docs/repl.txt | 10 ++++---- .../array/uint64/docs/types/index.d.ts | 10 ++++---- .../@stdlib/array/uint64/lib/main.js | 10 ++++---- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/node_modules/@stdlib/array/uint64/README.md b/lib/node_modules/@stdlib/array/uint64/README.md index 9e7ea549f00d..a58e6c7800f5 100644 --- a/lib/node_modules/@stdlib/array/uint64/README.md +++ b/lib/node_modules/@stdlib/array/uint64/README.md @@ -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 [ 1n ] // Get the last element: -z = arr.at( -1 ); +u = arr.at( -1 ); // returns [ 9n ] ``` @@ -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 ``` @@ -329,7 +329,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 [ 1n ] ``` @@ -338,7 +338,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 ``` @@ -355,14 +355,14 @@ var arr = new Uint64Array( [ 1, 2, 3 ] ); // returns [ 1n, 2n, 3n ] // Get the first element: -var z = arr.get( 0 ); +var u = arr.get( 0 ); // returns [ 1n ] // Set the first element: arr.set( new Uint64( 5 ) ); // Get the first element: -z = arr.get( 0 ); +u = arr.get( 0 ); // returns [ 5n ] ``` @@ -375,14 +375,14 @@ var arr = new Uint64Array( [ 1, 2, 3 ] ); // returns [ 1n, 2n, 3n ] // Get the third element: -var z = arr.get( 2 ); +var u = arr.get( 2 ); // returns [ 3n ] // Set the third element: arr.set( new Uint64( 5 ), 2 ); // Get the third element: -z = arr.get( 2 ); +u = arr.get( 2 ); // returns [ 5n ] ``` @@ -397,10 +397,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 [ 4n ] -z = arr.get( 1 ); +u = arr.get( 1 ); // returns [ 5n ] ``` diff --git a/lib/node_modules/@stdlib/array/uint64/docs/repl.txt b/lib/node_modules/@stdlib/array/uint64/docs/repl.txt index 6dd3c27d5987..c737fc5bf588 100644 --- a/lib/node_modules/@stdlib/array/uint64/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/uint64/docs/repl.txt @@ -248,7 +248,7 @@ -------- > var arr = new {{alias}}( [ 1, 2 ] ) [ 1n, 2n ] - > var z = arr.at( 1 ) + > var u = arr.at( 1 ) [ 2n ] @@ -295,7 +295,7 @@ -------- > var arr = new {{alias}}( [ 1, 2 ] ) [ 1n, 2n ] - > var z = arr.get( 1 ) + > var u = arr.get( 1 ) [ 2n ] @@ -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 ) [ 4n ] > arr.set( [ 5, 6 ], 1 ); - > z = arr.get( 1 ) + > u = arr.get( 1 ) [ 5n ] - > z = arr.get( 2 ) + > u = arr.get( 2 ) [ 6n ] See Also diff --git a/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts index 73e7941a80c5..bad3583b2520 100644 --- a/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts @@ -469,15 +469,15 @@ declare class Uint64Array implements Uint64ArrayInterface { * @example * var arr = new Uint64Array( 10 ); * - * var z = arr.get( 0 ); + * var u = arr.get( 0 ); * // returns [ 0n ] * * arr.set( 1, 0 ); * - * var z = arr.get( 0 ); + * var u = arr.get( 0 ); * // returns [ 1n ] * - * z = arr.get( 100 ); + * u = arr.get( 100 ); * // returns undefined */ get( i: number ): Uint64 | void; @@ -516,12 +516,12 @@ declare class Uint64Array implements Uint64ArrayInterface { * @example * var arr = new Uint64Array( 10 ); * - * var z = arr.get( 0 ); + * var u = arr.get( 0 ); * // returns [ 0n ] * * arr.set( 1, 0 ); * - * z = arr.get( 0 ); + * u = arr.get( 0 ); * // returns [ 1n ] */ set( value: ArrayLike | Uint64Array | Uint, i?: number ): void; diff --git a/lib/node_modules/@stdlib/array/uint64/lib/main.js b/lib/node_modules/@stdlib/array/uint64/lib/main.js index 031b576e9321..52a606cc76c0 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/main.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/main.js @@ -720,15 +720,15 @@ setReadOnly( Uint64Array.prototype, 'entries', function entries() { * @example * var arr = new Uint64Array( 10 ); * -* var z = arr.get( 0 ); +* var u = arr.get( 0 ); * // returns [ 0n ] * * arr.set( [ 1 ], 0 ); * -* z = arr.get( 0 ); +* u = arr.get( 0 ); * // returns [ 1n ] * -* z = arr.get( 100 ); +* u = arr.get( 100 ); * // returns undefined */ setReadOnly( Uint64Array.prototype, 'get', function get( idx ) { @@ -801,12 +801,12 @@ setReadOnlyAccessor( Uint64Array.prototype, 'length', function get() { * @example * var arr = new Uint64Array( 10 ); * -* var z = arr.get( 0 ); +* var u = arr.get( 0 ); * // returns [ 0n ] * * arr.set( 1n, 0 ); * -* z = arr.get( 0 ); +* u = arr.get( 0 ); * // returns [ 1n ] */ setReadOnly( Uint64Array.prototype, 'set', function set( value ) { From e78d2afdcce00706ec75f7c58a92abedca30bdaf Mon Sep 17 00:00:00 2001 From: Divit Date: Fri, 21 Aug 2026 19:16:01 +0000 Subject: [PATCH 4/8] chore: update examples --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/array/uint64/README.md | 7 +------ .../@stdlib/array/uint64/docs/types/index.d.ts | 7 +------ lib/node_modules/@stdlib/array/uint64/lib/main.js | 7 +------ 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/lib/node_modules/@stdlib/array/uint64/README.md b/lib/node_modules/@stdlib/array/uint64/README.md index a58e6c7800f5..1a399809813f 100644 --- a/lib/node_modules/@stdlib/array/uint64/README.md +++ b/lib/node_modules/@stdlib/array/uint64/README.md @@ -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(); diff --git a/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts index bad3583b2520..9c8c4dafaef0 100644 --- a/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts @@ -434,12 +434,7 @@ declare class Uint64Array implements Uint64ArrayInterface { * @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(); diff --git a/lib/node_modules/@stdlib/array/uint64/lib/main.js b/lib/node_modules/@stdlib/array/uint64/lib/main.js index 52a606cc76c0..f2f875385206 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/main.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/main.js @@ -606,12 +606,7 @@ setReadOnly( Uint64Array.prototype, 'BYTES_PER_ELEMENT', Uint64Array.BYTES_PER_E * @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(); From bf0b158e0a6d17928f2929e1a6eca86d8bddac17 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 14 Oct 2026 00:39:47 +0200 Subject: [PATCH 5/8] docs: update example Signed-off-by: Athan --- lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts index 9c8c4dafaef0..78b11c503625 100644 --- a/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/uint64/docs/types/index.d.ts @@ -469,7 +469,7 @@ declare class Uint64Array implements Uint64ArrayInterface { * * arr.set( 1, 0 ); * - * var u = arr.get( 0 ); + * u = arr.get( 0 ); * // returns [ 1n ] * * u = arr.get( 100 ); From 1dee9f26fbc027aabf69b4b85b37c371ff85e7c2 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 14 Oct 2026 00:43:27 +0200 Subject: [PATCH 6/8] Apply batched suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/array/uint64/lib/from_array.js | 2 +- lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js | 2 +- lib/node_modules/@stdlib/array/uint64/lib/main.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/array/uint64/lib/from_array.js b/lib/node_modules/@stdlib/array/uint64/lib/from_array.js index 65d4641fe4e6..bccdf89e6e8c 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/from_array.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/from_array.js @@ -51,7 +51,7 @@ function fromArray( buf, arr ) { for ( i = 0; i < len; i++ ) { 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`.', v ) ); + 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 ]; diff --git a/lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js b/lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js index cf83a138c7c5..1f7c3bcecc3b 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js @@ -51,7 +51,7 @@ function fromIterator( it ) { } 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`.', u ) ); + 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 ] ); diff --git a/lib/node_modules/@stdlib/array/uint64/lib/main.js b/lib/node_modules/@stdlib/array/uint64/lib/main.js index e96a3b230a0a..aa6579db6480 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/main.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/main.js @@ -906,7 +906,7 @@ setReadOnly( Uint64Array.prototype, 'set', function set( value ) { for ( i = 0; i < N; i++ ) { 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`.', v ) ); + 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 ]; From 755d4b7b85a02e031e99519a9ccec40fce48e6ff Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 14 Oct 2026 00:46:55 +0200 Subject: [PATCH 7/8] fix: interpolate return value in error message Signed-off-by: Athan --- .../@stdlib/array/uint64/lib/from_iterator_map.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js b/lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js index 54ca13b48ebb..0997d036e3a2 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js @@ -41,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: @@ -54,9 +55,10 @@ function fromIteratorMap( it, clbk, thisArg ) { break; } i += 1; - u = scalarToUint64( clbk.call( thisArg, v.value, i ) ); + 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`.', u ) ); + 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 ] ); From da4a37b90dcdba17c34c565fd2397ff9adf85108 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 14 Oct 2026 00:48:56 +0200 Subject: [PATCH 8/8] fix: interpolate callback return value in error message Signed-off-by: Athan --- lib/node_modules/@stdlib/array/uint64/lib/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/array/uint64/lib/main.js b/lib/node_modules/@stdlib/array/uint64/lib/main.js index aa6579db6480..92908ee29a86 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/main.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/main.js @@ -404,9 +404,10 @@ setReadOnly( Uint64Array, 'from', function from( src ) { words = [ 0, 0 ]; j = 0; for ( i = 0; i < len; i++ ) { - v = scalarToUint64( clbk.call( thisArg, get( src, i ), i ) ); + 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`.', v ) ); + 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 ];