Skip to content

Commit 43df04e

Browse files
committed
Auto-generated commit
1 parent 29e5c44 commit 43df04e

File tree

12 files changed

+753
-3
lines changed

12 files changed

+753
-3
lines changed

CHANGELOG.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2024-09-28)
7+
## Unreleased (2024-10-08)
88

99
<section class="packages">
1010

@@ -191,6 +191,40 @@
191191

192192
<!-- /.package -->
193193

194+
<section class="package" id="assert-is-same-typed-array-like-unreleased">
195+
196+
#### [@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)
197+
198+
<details>
199+
200+
<section class="features">
201+
202+
##### Features
203+
204+
- [`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)
205+
206+
</section>
207+
208+
<!-- /.features -->
209+
210+
<section class="issues">
211+
212+
##### Closed Issues
213+
214+
This release closes the following issue:
215+
216+
[#2887](https://github.com/stdlib-js/stdlib/issues/2887)
217+
218+
</section>
219+
220+
<!-- /.issues -->
221+
222+
</details>
223+
224+
</section>
225+
226+
<!-- /.package -->
227+
194228
<section class="package" id="assert-is-wasm-memory-unreleased">
195229

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

218252
<!-- /.packages -->
219253

254+
<section class="issues">
255+
256+
### Closed Issues
257+
258+
This release closes the following issue:
259+
260+
[#2887](https://github.com/stdlib-js/stdlib/issues/2887)
261+
262+
</section>
263+
264+
<!-- /.issues -->
265+
220266
<section class="contributors">
221267

222268
### Contributors
223269

224-
A total of 5 people contributed to this release. Thank you to the following contributors:
270+
A total of 6 people contributed to this release. Thank you to the following contributors:
225271

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

240287
<details>
241288

289+
- [`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)_
242290
- [`abf0407`](https://github.com/stdlib-js/stdlib/commit/abf040787f6598438b0100a729a8331b7f80f62f) - **chore:** resolve lint errors in TS files _(by Philipp Burckhardt)_
243291
- [`ff9fa81`](https://github.com/stdlib-js/stdlib/commit/ff9fa81f917d539f1a11fba5580e1744991a8a11) - **docs:** fix TSDoc lint errors _(by Philipp Burckhardt)_
244292
- [`f477e26`](https://github.com/stdlib-js/stdlib/commit/f477e26a03e5e365f2e7c4035959a2fb789698a3) - **chore:** move functions to parent scope _(by Philipp Burckhardt)_

CONTRIBUTORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Contributors listed in alphabetical order.
44

5-
Aayush Khanna <96649223+aayush0325@users.noreply.github.com>
5+
Aayush Khanna <aayushiitbhu23@gmail.com>
66
Adarsh Palaskar <adarshpalaskar99@gmail.com>
77
Aditya Sapra <adityaework@gmail.com>
88
AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com>

is-same-typed-array-like/README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2024 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# isSameArrayLike
22+
23+
> Test if two arguments are both typed-array-like objects and have the [same values][@stdlib/assert/is-same-value].
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var isSameTypedArrayLike = require( '@stdlib/assert/is-same-typed-array-like' );
31+
```
32+
33+
#### isSameTypedArrayLike( v1, v2 )
34+
35+
Tests if two arguments are both typed-array-like objects and have the [same values][@stdlib/assert/is-same-value].
36+
37+
```javascript
38+
var Int8Array = require( '@stdlib/array/int8' );
39+
var Int16Array = require( '@stdlib/array/int16' );
40+
41+
var x = new Int8Array( [ 1.0, 2.0 ] );
42+
var y = new Int16Array( [ 1.0, 2.0 ] );
43+
var bool = isSameTypedArrayLike( x, y );
44+
// returns true
45+
46+
bool = isSameTypedArrayLike( x, new Int8Array( [ -1.0, 2.0 ] ) );
47+
// returns false
48+
```
49+
50+
</section>
51+
52+
<!-- /.usage -->
53+
54+
<section class="examples">
55+
56+
## Examples
57+
58+
<!-- eslint no-undef: "error" -->
59+
60+
```javascript
61+
var Int8Array = require( '@stdlib/array/int8' );
62+
var Int16Array = require( '@stdlib/array/int16' );
63+
var isSameTypedArrayLike = require( '@stdlib/assert/is-same-typed-array-like' );
64+
65+
var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
66+
var y = new Int16Array( [ 1.0, 2.0, 3.0 ] );
67+
var out = isSameTypedArrayLike( x, y );
68+
// returns true
69+
70+
x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
71+
y = new Int16Array( [ 1.0, 2.0, 4.0 ] );
72+
out = isSameTypedArrayLike( x, y );
73+
// returns false
74+
```
75+
76+
</section>
77+
78+
<!-- /.examples -->
79+
80+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
81+
82+
<section class="related">
83+
84+
</section>
85+
86+
<!-- /.related -->
87+
88+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
89+
90+
<section class="links">
91+
92+
[@stdlib/assert/is-same-value]: https://github.com/stdlib-js/assert/tree/main/is-same-value
93+
94+
<!-- <related-links> -->
95+
96+
<!-- </related-links> -->
97+
98+
</section>
99+
100+
<!-- /.links -->
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var isBoolean = require( './../../is-boolean' ).isPrimitive;
25+
var pow = require( '@stdlib/math/base/special/pow' );
26+
var Int8Array = require( '@stdlib/array/int8' );
27+
var pkg = require( './../package.json' ).name;
28+
var isSameTypedArrayLike = require( './../lib' );
29+
30+
31+
// FUNCTIONS //
32+
33+
/**
34+
* Creates a benchmark function.
35+
*
36+
* @private
37+
* @param {PositiveInteger} len - array length
38+
* @returns {Function} benchmark function
39+
*/
40+
function createBenchmark( len ) {
41+
var x = new Int8Array( len );
42+
var y = new Int8Array( len );
43+
return benchmark;
44+
45+
/**
46+
* Benchmark function.
47+
*
48+
* @private
49+
* @param {Benchmark} b - benchmark instance
50+
*/
51+
function benchmark( b ) {
52+
var bool;
53+
var i;
54+
55+
b.tic();
56+
for ( i = 0; i < b.iterations; i++ ) {
57+
bool = isSameTypedArrayLike( x, y );
58+
if ( typeof bool !== 'boolean' ) {
59+
b.fail( 'should return a boolean' );
60+
}
61+
}
62+
b.toc();
63+
if ( !isBoolean( bool ) ) {
64+
b.fail( 'should return a boolean' );
65+
}
66+
b.pass( 'benchmark finished' );
67+
b.end();
68+
}
69+
}
70+
71+
72+
// MAIN //
73+
74+
/**
75+
* Main execution sequence.
76+
*
77+
* @private
78+
*/
79+
function main() {
80+
var len;
81+
var min;
82+
var max;
83+
var f;
84+
var i;
85+
86+
min = 1; // 10^min
87+
max = 6; // 10^max
88+
89+
for ( i = min; i <= max; i++ ) {
90+
len = pow( 10, i );
91+
f = createBenchmark( len );
92+
bench( pkg+':len='+len, f );
93+
}
94+
}
95+
96+
main();
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
{{alias}}( v1, v2 )
3+
Tests if two arguments are both typed-array-like objects and have the same
4+
values.
5+
6+
Parameters
7+
----------
8+
v1: any
9+
First input value.
10+
11+
v2: any
12+
Second input value.
13+
14+
Returns
15+
-------
16+
bool: boolean
17+
Boolean indicating whether two arguments are both typed-array-like
18+
objects and have the same values.
19+
20+
Examples
21+
--------
22+
> var Int8Array = require( '@stdlib/array/int8' );
23+
> var Int16Array = require( '@stdlib/array/int16' );
24+
> var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
25+
> var y = new Int16Array( [ 1.0, 2.0, 3.0 ] );
26+
> var bool = {{alias}}( x, y )
27+
true
28+
29+
> x = new Int8Array( [ 1.0, 2.0, 4.0 ] );
30+
> y = new Int8Array( [ 1.0, 2.0, 3.0 ] );
31+
> bool = {{alias}}( x, y )
32+
false
33+
34+
See Also
35+
--------
36+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 4.1
20+
21+
/**
22+
* Tests if two arguments are both typed-array-like objects and have the same values.
23+
*
24+
* @param v1 - first input value
25+
* @param v2 - second input value
26+
* @returns boolean indicating whether the two arguments are both typed-array-like objects with the same values
27+
*
28+
* @example
29+
* var Int8Array = require( '@stdlib/array/int8' );
30+
* var Int16Array = require( '@stdlib/array/int16' );
31+
* var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
32+
* var y = new Int16Array( [ 1.0, 2.0, 3.0 ] );
33+
*
34+
* var out = isSameTypedArrayLike( x, y );
35+
* // returns true
36+
*
37+
* @example
38+
* var Int8Array = require( '@stdlib/array/int8' );
39+
* var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
40+
* var y = new Int8Array( [ 1.0, 2.0, 4.0 ] );
41+
*
42+
* var out = isSameTypedArrayLike( x, y );
43+
* // returns false
44+
*/
45+
declare function isSameTypedArrayLike( v1: any, v2: any ): boolean;
46+
47+
48+
// EXPORTS //
49+
50+
export = isSameTypedArrayLike;

0 commit comments

Comments
 (0)