Repository navigation
feat: add arrest/is-equal-uint64array
#15616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kgryte
merged 12 commits into
stdlib-js:develop
from
DivitJain26:feat/add-is-same-uint64array
Oct 13, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a91b0f9
feat: add is-same-uint64array
DivitJain26 bb8c938
fix: implement is-equal-uint64array
DivitJain26 0229b40
test: add tests
DivitJain26 e7a241e
bench: add benchmark
DivitJain26 efec2d2
docs: add types and tests
DivitJain26 852bdce
docs: add repl txt
DivitJain26 ddfa019
docs: add example
DivitJain26 1c34ce4
docs: add readme
DivitJain26 c60c58d
chore: cleanup
DivitJain26 0391345
Merge remote-tracking branch 'upstream/develop' into feat/add-is-same…
stdlib-bot 6560878
chore: remove is-same-uint64array from PR scope
DivitJain26 83012d7
docs: add links
kgryte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
lib/node_modules/@stdlib/assert/is-equal-uint64array/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| <!-- | ||
|
|
||
| @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. | ||
|
|
||
| --> | ||
|
|
||
| # isEqualUint64Array | ||
|
|
||
| > Test if two arguments are both [Uint64Arrays][@stdlib/array/uint64] and have equal values. | ||
|
|
||
| <section class="usage"> | ||
|
|
||
| ## Usage | ||
|
|
||
| ```javascript | ||
| var isEqualUint64Array = require( '@stdlib/assert/is-equal-uint64array' ); | ||
| ``` | ||
|
|
||
| #### isEqualUint64Array( v1, v2 ) | ||
|
|
||
| Tests if two arguments are both [Uint64Arrays][@stdlib/array/uint64] and have equal values. | ||
|
|
||
| ```javascript | ||
| var Uint64Array = require( '@stdlib/array/uint64' ); | ||
|
|
||
| var x = new Uint64Array( [ 1, 2 ] ); | ||
| var y = new Uint64Array( [ 1, 2 ] ); | ||
| var bool = isEqualUint64Array( x, y ); | ||
| // returns true | ||
|
|
||
| bool = isEqualUint64Array( x, new Uint64Array( [ 1, 3 ] ) ); | ||
| // returns false | ||
| ``` | ||
|
|
||
| </section> | ||
|
|
||
| <!-- /.usage --> | ||
|
|
||
| <section class="notes"> | ||
|
|
||
| </section> | ||
|
|
||
| <!-- /.notes --> | ||
|
|
||
| <section class="examples"> | ||
|
|
||
| ## Examples | ||
|
|
||
| <!-- eslint no-undef: "error" --> | ||
|
|
||
| ```javascript | ||
| var Int64Array = require( '@stdlib/array/int64' ); | ||
| var Uint64Array = require( '@stdlib/array/uint64' ); | ||
| var isEqualUint64Array = require( '@stdlib/assert/is-equal-uint64array' ); | ||
|
|
||
| var x = new Uint64Array( [ 1, 2, 3 ] ); | ||
| var y = new Uint64Array( [ 1, 2, 3 ] ); | ||
| var out = isEqualUint64Array( x, y ); | ||
| // returns true | ||
|
|
||
| x = new Uint64Array( [ 1, 2, 3 ] ); | ||
| y = new Int64Array( [ 1, 2, 3 ] ); | ||
| out = isEqualUint64Array( x, y ); | ||
| // returns false | ||
|
|
||
| x = new Uint64Array( [ 1, 2, 3 ] ); | ||
| y = new Uint64Array( [ 1, 2, 4 ] ); | ||
| out = isEqualUint64Array( x, y ); | ||
| // returns false | ||
| ``` | ||
|
|
||
| </section> | ||
|
|
||
| <!-- /.examples --> | ||
|
|
||
| <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> | ||
|
|
||
| <section class="related"> | ||
|
|
||
| </section> | ||
|
|
||
| <!-- /.related --> | ||
|
|
||
| <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
|
|
||
| <section class="links"> | ||
|
|
||
| [@stdlib/array/uint64]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/uint64 | ||
|
|
||
| </section> | ||
|
|
||
| <!-- /.links --> |
98 changes: 98 additions & 0 deletions
98
lib/node_modules/@stdlib/assert/is-equal-uint64array/benchmark/benchmark.length.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| /** | ||
| * @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 bench = require( '@stdlib/bench' ); | ||
| var format = require( '@stdlib/string/format' ); | ||
| var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; | ||
| var pow = require( '@stdlib/math/base/special/pow' ); | ||
| var Uint64Array = require( '@stdlib/array/uint64' ); | ||
| var zeroTo = require( '@stdlib/array/zero-to' ); | ||
| var pkg = require( './../package.json' ).name; | ||
| var isEqualUint64Array = require( './../lib' ); | ||
|
|
||
|
|
||
| // FUNCTIONS // | ||
|
|
||
| /** | ||
| * Creates a benchmark function. | ||
| * | ||
| * @private | ||
| * @param {PositiveInteger} len - array length | ||
| * @returns {Function} benchmark function | ||
| */ | ||
| function createBenchmark( len ) { | ||
| var x = new Uint64Array( zeroTo( len ) ); | ||
| var y = new Uint64Array( zeroTo( len ) ); | ||
| return benchmark; | ||
|
|
||
| /** | ||
| * Benchmark function. | ||
| * | ||
| * @private | ||
| * @param {Benchmark} b - benchmark instance | ||
| */ | ||
| function benchmark( b ) { | ||
| var bool; | ||
| var i; | ||
|
|
||
| b.tic(); | ||
| for ( i = 0; i < b.iterations; i++ ) { | ||
| bool = isEqualUint64Array( x, y ); | ||
| if ( typeof bool !== 'boolean' ) { | ||
| b.fail( 'should return a boolean' ); | ||
| } | ||
| } | ||
| b.toc(); | ||
| if ( !isBoolean( bool ) ) { | ||
| b.fail( 'should return a boolean' ); | ||
| } | ||
| b.pass( 'benchmark finished' ); | ||
| b.end(); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| // MAIN // | ||
|
|
||
| /** | ||
| * Main execution sequence. | ||
| * | ||
| * @private | ||
| */ | ||
| function main() { | ||
| var len; | ||
| var min; | ||
| var max; | ||
| var f; | ||
| var i; | ||
|
|
||
| min = 1; // 10^min | ||
| max = 6; // 10^max | ||
|
|
||
| for ( i = min; i <= max; i++ ) { | ||
| len = pow( 10, i ); | ||
| f = createBenchmark( len ); | ||
| bench( format( '%s:len=%d', pkg, len ), f ); | ||
| } | ||
| } | ||
|
|
||
| main(); | ||
32 changes: 32 additions & 0 deletions
32
lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/repl.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
|
|
||
| {{alias}}( v1, v2 ) | ||
| Tests if two arguments are both Uint64Arrays and have equal values. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| v1: any | ||
| First input value. | ||
|
|
||
| v2: any | ||
| Second input value. | ||
|
|
||
| Returns | ||
| ------- | ||
| bool: boolean | ||
| Boolean indicating whether two arguments are equal. | ||
|
|
||
| Examples | ||
| -------- | ||
| > var x = new {{alias:@stdlib/array/uint64}}( [ 1, 2, 3 ] ); | ||
| > var y = new {{alias:@stdlib/array/uint64}}( [ 1, 2, 3 ] ); | ||
| > var bool = {{alias}}( x, y ) | ||
| true | ||
|
|
||
| > x = new {{alias:@stdlib/array/uint64}}( [ 1, 2, 3 ] ); | ||
| > y = new {{alias:@stdlib/array/uint64}}( [ 1, 2, 4 ] ); | ||
| > bool = {{alias}}( x, y ) | ||
| false | ||
|
|
||
| See Also | ||
| -------- | ||
|
|
51 changes: 51 additions & 0 deletions
51
lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/types/index.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. | ||
| */ | ||
|
|
||
| // TypeScript Version: 4.1 | ||
|
|
||
| /** | ||
| * Tests if two arguments are both Uint64Arrays and have equal values. | ||
| * | ||
| * @param v1 - first input value | ||
| * @param v2 - second input value | ||
| * @returns boolean indicating whether two arguments are equal | ||
| * | ||
| * @example | ||
| * var Uint64Array = require( '@stdlib/array/uint64' ); | ||
| * | ||
| * var x = new Uint64Array( [ 1, 2, 3 ] ); | ||
| * var y = new Uint64Array( [ 1, 2, 3 ] ); | ||
| * | ||
| * var out = isEqualUint64Array( x, y ); | ||
| * // returns true | ||
| * | ||
| * @example | ||
| * var Uint64Array = require( '@stdlib/array/uint64' ); | ||
| * | ||
| * var x = new Uint64Array( [ 1, 2, 3 ] ); | ||
| * var y = new Uint64Array( [ 1, 2, 4 ] ); | ||
| * | ||
| * var out = isEqualUint64Array( x, y ); | ||
| * // returns false | ||
| */ | ||
| declare function isEqualUint64Array( v1: any, v2: any ): boolean; | ||
|
Check warning on line 46 in lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/types/index.d.ts
|
||
|
|
||
|
|
||
| // EXPORTS // | ||
|
|
||
| export = isEqualUint64Array; | ||
36 changes: 36 additions & 0 deletions
36
lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/types/test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * @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. | ||
| */ | ||
|
|
||
| import isEqualUint64Array = require( './index' ); | ||
|
|
||
|
|
||
| // TESTS // | ||
|
|
||
| // The function returns a boolean... | ||
| { | ||
| isEqualUint64Array( 3.14, 3.14 ); // $ExpectType boolean | ||
| isEqualUint64Array( null, null ); // $ExpectType boolean | ||
| isEqualUint64Array( 'beep', 'boop' ); // $ExpectType boolean | ||
| } | ||
|
|
||
| // The compiler throws an error if the function is provided an unsupported number of arguments... | ||
| { | ||
| isEqualUint64Array(); // $ExpectError | ||
| isEqualUint64Array( 3.14 ); // $ExpectError | ||
| isEqualUint64Array( 'beep', 'beep', 3.14 ); // $ExpectError | ||
| } |
41 changes: 41 additions & 0 deletions
41
lib/node_modules/@stdlib/assert/is-equal-uint64array/examples/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /** | ||
| * @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'; | ||
|
|
||
| var Int64Array = require( '@stdlib/array/int64' ); | ||
| var Uint64Array = require( '@stdlib/array/uint64' ); | ||
| var isEqualUint64Array = require( './../lib' ); | ||
|
|
||
| var x = new Uint64Array( [ 1, 2, 3 ] ); | ||
| var y = new Uint64Array( [ 1, 2, 3 ] ); | ||
| var out = isEqualUint64Array( x, y ); | ||
| console.log( out ); | ||
| // => true | ||
|
|
||
| x = new Uint64Array( [ 1, 2, 3 ] ); | ||
| y = new Int64Array( [ 1, 2, 3 ] ); | ||
| out = isEqualUint64Array( x, y ); | ||
| console.log( out ); | ||
| // => false | ||
|
|
||
| x = new Uint64Array( [ 1, 2, 3 ] ); | ||
| y = new Uint64Array( [ 1, 2, 4 ] ); | ||
| out = isEqualUint64Array( x, y ); | ||
| console.log( out ); | ||
| // => false |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as for
int64. We'll want to circle back once we haveuint64support inzero-to.