Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Oct 8, 2024
1 parent 29e5c44 commit 43df04e
Show file tree
Hide file tree
Showing 12 changed files with 753 additions and 3 deletions.
52 changes: 50 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<section class="release" id="unreleased">

## Unreleased (2024-09-28)
## Unreleased (2024-10-08)

<section class="packages">

Expand Down Expand Up @@ -191,6 +191,40 @@

<!-- /.package -->

<section class="package" id="assert-is-same-typed-array-like-unreleased">

#### [@stdlib/assert/is-same-typed-array-like](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-same-typed-array-like)

<details>

<section class="features">

##### Features

- [`4927336`](https://github.com/stdlib-js/stdlib/commit/4927336d5b2b4a7d2baf0e7d854b406d309fac17) - add `assert/is-same-typed-array-like` [(#2939)](https://github.com/stdlib-js/stdlib/pull/2939)

</section>

<!-- /.features -->

<section class="issues">

##### Closed Issues

This release closes the following issue:

[#2887](https://github.com/stdlib-js/stdlib/issues/2887)

</section>

<!-- /.issues -->

</details>

</section>

<!-- /.package -->

<section class="package" id="assert-is-wasm-memory-unreleased">

#### [@stdlib/assert/is-wasm-memory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-wasm-memory)
Expand All @@ -217,13 +251,26 @@

<!-- /.packages -->

<section class="issues">

### Closed Issues

This release closes the following issue:

[#2887](https://github.com/stdlib-js/stdlib/issues/2887)

</section>

<!-- /.issues -->

<section class="contributors">

### Contributors

A total of 5 people contributed to this release. Thank you to the following contributors:
A total of 6 people contributed to this release. Thank you to the following contributors:

- Aayush Khanna
- Aditya Sapra
- Athan Reines
- Philipp Burckhardt
- Soumajit Chatterjee
Expand All @@ -239,6 +286,7 @@ A total of 5 people contributed to this release. Thank you to the following cont

<details>

- [`4927336`](https://github.com/stdlib-js/stdlib/commit/4927336d5b2b4a7d2baf0e7d854b406d309fac17) - **feat:** add `assert/is-same-typed-array-like` [(#2939)](https://github.com/stdlib-js/stdlib/pull/2939) _(by Aditya Sapra, Philipp Burckhardt)_
- [`abf0407`](https://github.com/stdlib-js/stdlib/commit/abf040787f6598438b0100a729a8331b7f80f62f) - **chore:** resolve lint errors in TS files _(by Philipp Burckhardt)_
- [`ff9fa81`](https://github.com/stdlib-js/stdlib/commit/ff9fa81f917d539f1a11fba5580e1744991a8a11) - **docs:** fix TSDoc lint errors _(by Philipp Burckhardt)_
- [`f477e26`](https://github.com/stdlib-js/stdlib/commit/f477e26a03e5e365f2e7c4035959a2fb789698a3) - **chore:** move functions to parent scope _(by Philipp Burckhardt)_
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Contributors listed in alphabetical order.

Aayush Khanna <[email protected].com>
Aayush Khanna <aayushiitbhu23@gmail.com>
Adarsh Palaskar <[email protected]>
Aditya Sapra <[email protected]>
AgPriyanshu18 <[email protected]>
Expand Down
100 changes: 100 additions & 0 deletions is-same-typed-array-like/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!--
@license Apache-2.0
Copyright (c) 2024 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.
-->

# isSameArrayLike

> Test if two arguments are both typed-array-like objects and have the [same values][@stdlib/assert/is-same-value].
<section class="usage">

## Usage

```javascript
var isSameTypedArrayLike = require( '@stdlib/assert/is-same-typed-array-like' );
```

#### isSameTypedArrayLike( v1, v2 )

Tests if two arguments are both typed-array-like objects and have the [same values][@stdlib/assert/is-same-value].

```javascript
var Int8Array = require( '@stdlib/array/int8' );
var Int16Array = require( '@stdlib/array/int16' );

var x = new Int8Array( [ 1.0, 2.0 ] );
var y = new Int16Array( [ 1.0, 2.0 ] );
var bool = isSameTypedArrayLike( x, y );
// returns true

bool = isSameTypedArrayLike( x, new Int8Array( [ -1.0, 2.0 ] ) );
// returns false
```

</section>

<!-- /.usage -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var Int8Array = require( '@stdlib/array/int8' );
var Int16Array = require( '@stdlib/array/int16' );
var isSameTypedArrayLike = require( '@stdlib/assert/is-same-typed-array-like' );

var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
var y = new Int16Array( [ 1.0, 2.0, 3.0 ] );
var out = isSameTypedArrayLike( x, y );
// returns true

x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
y = new Int16Array( [ 1.0, 2.0, 4.0 ] );
out = isSameTypedArrayLike( 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/assert/is-same-value]: https://github.com/stdlib-js/assert/tree/main/is-same-value

<!-- <related-links> -->

<!-- </related-links> -->

</section>

<!-- /.links -->
96 changes: 96 additions & 0 deletions is-same-typed-array-like/benchmark/benchmark.length.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 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 isBoolean = require( './../../is-boolean' ).isPrimitive;
var pow = require( '@stdlib/math/base/special/pow' );
var Int8Array = require( '@stdlib/array/int8' );
var pkg = require( './../package.json' ).name;
var isSameTypedArrayLike = require( './../lib' );


// FUNCTIONS //

/**
* Creates a benchmark function.
*
* @private
* @param {PositiveInteger} len - array length
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x = new Int8Array( len );
var y = new Int8Array( 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 = isSameTypedArrayLike( 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( pkg+':len='+len, f );
}
}

main();
36 changes: 36 additions & 0 deletions is-same-typed-array-like/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

{{alias}}( v1, v2 )
Tests if two arguments are both typed-array-like objects and have the same
values.

Parameters
----------
v1: any
First input value.

v2: any
Second input value.

Returns
-------
bool: boolean
Boolean indicating whether two arguments are both typed-array-like
objects and have the same values.

Examples
--------
> var Int8Array = require( '@stdlib/array/int8' );
> var Int16Array = require( '@stdlib/array/int16' );
> var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
> var y = new Int16Array( [ 1.0, 2.0, 3.0 ] );
> var bool = {{alias}}( x, y )
true

> x = new Int8Array( [ 1.0, 2.0, 4.0 ] );
> y = new Int8Array( [ 1.0, 2.0, 3.0 ] );
> bool = {{alias}}( x, y )
false

See Also
--------

50 changes: 50 additions & 0 deletions is-same-typed-array-like/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2024 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 typed-array-like objects and have the same values.
*
* @param v1 - first input value
* @param v2 - second input value
* @returns boolean indicating whether the two arguments are both typed-array-like objects with the same values
*
* @example
* var Int8Array = require( '@stdlib/array/int8' );
* var Int16Array = require( '@stdlib/array/int16' );
* var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
* var y = new Int16Array( [ 1.0, 2.0, 3.0 ] );
*
* var out = isSameTypedArrayLike( x, y );
* // returns true
*
* @example
* var Int8Array = require( '@stdlib/array/int8' );
* var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
* var y = new Int8Array( [ 1.0, 2.0, 4.0 ] );
*
* var out = isSameTypedArrayLike( x, y );
* // returns false
*/
declare function isSameTypedArrayLike( v1: any, v2: any ): boolean;


// EXPORTS //

export = isSameTypedArrayLike;
Loading

0 comments on commit 43df04e

Please sign in to comment.