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
106 changes: 106 additions & 0 deletions lib/node_modules/@stdlib/assert/is-equal-uint64array/README.md
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 -->
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 ) );

Copy link
Copy Markdown
Member

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 have uint64 support in zero-to.

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 lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/repl.txt
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
--------

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

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

Check warning on line 46 in lib/node_modules/@stdlib/assert/is-equal-uint64array/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type


// EXPORTS //

export = isEqualUint64Array;
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
}
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
Loading
Loading