Skip to content

Commit 5cee291

Browse files
committed
Auto-generated commit
1 parent ecff63a commit 5cee291

File tree

14 files changed

+772
-2
lines changed

14 files changed

+772
-2
lines changed

CHANGELOG.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,93 @@
22

33
> Package changelog.
44
5+
<section class="release" id="unreleased">
6+
7+
## Unreleased (2024-09-08)
8+
9+
<section class="packages">
10+
11+
### Packages
12+
13+
<section class="package" id="assert-unreleased">
14+
15+
#### [@stdlib/assert](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert)
16+
17+
<details>
18+
19+
<section class="features">
20+
21+
##### Features
22+
23+
- [`d64eaf8`](https://github.com/stdlib-js/stdlib/commit/d64eaf86a770b6d7fad0078d65afe7e2a79361cb) - add `isSameArrayLike` to namespace
24+
25+
</section>
26+
27+
<!-- /.features -->
28+
29+
</details>
30+
31+
</section>
32+
33+
<!-- /.package -->
34+
35+
<section class="package" id="assert-is-same-array-like-unreleased">
36+
37+
#### [@stdlib/assert/is-same-array-like](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-same-array-like)
38+
39+
<details>
40+
41+
<section class="features">
42+
43+
##### Features
44+
45+
- [`4e4d18d`](https://github.com/stdlib-js/stdlib/commit/4e4d18d142ca65c1257c2e2b7fa979dbbafb4741) - add `assert/is-same-array-like`
46+
47+
</section>
48+
49+
<!-- /.features -->
50+
51+
</details>
52+
53+
</section>
54+
55+
<!-- /.package -->
56+
57+
</section>
58+
59+
<!-- /.packages -->
60+
61+
<section class="contributors">
62+
63+
### Contributors
64+
65+
A total of 1 person contributed to this release. Thank you to this contributor:
66+
67+
- Athan Reines
68+
69+
</section>
70+
71+
<!-- /.contributors -->
72+
73+
<section class="commits">
74+
75+
### Commits
76+
77+
<details>
78+
79+
- [`d64eaf8`](https://github.com/stdlib-js/stdlib/commit/d64eaf86a770b6d7fad0078d65afe7e2a79361cb) - **feat:** add `isSameArrayLike` to namespace _(by Athan Reines)_
80+
- [`4e4d18d`](https://github.com/stdlib-js/stdlib/commit/4e4d18d142ca65c1257c2e2b7fa979dbbafb4741) - **feat:** add `assert/is-same-array-like` _(by Athan Reines)_
81+
82+
</details>
83+
84+
</section>
85+
86+
<!-- /.commits -->
87+
88+
</section>
89+
90+
<!-- /.release -->
91+
592
<section class="release" id="v0.3.1">
693

794
## 0.3.1 (2024-08-18)

CONTRIBUTORS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>
2626
Frank Kovacs <fran70kk@gmail.com>
2727
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
2828
Gunj Joshi <gunjjoshi8372@gmail.com>
29+
HarshaNP <96897754+GittyHarsha@users.noreply.github.com>
2930
Harshita Kalani <harshitakalani02@gmail.com>
3031
Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com>
3132
Jaimin Godhani <112328542+Jai0401@users.noreply.github.com>
3233
James Gelok <jdgelok@gmail.com>
3334
Jaysukh Makvana <jaysukhmakvana2004@gmail.com>
35+
Jenish Thapa <141203631+jenish-thapa@users.noreply.github.com>
3436
Jithin KS <jithinks112@gmail.com>
3537
Joel Mathew Koshy <joelmathewkoshy@gmail.com>
3638
Joey Reed <joeyrreed@gmail.com>
@@ -86,8 +88,10 @@ Stephannie Jiménez Gacha <steff456@hotmail.com>
8688
Suraj kumar <125961509+kumarsuraj212003@users.noreply.github.com>
8789
Tirtadwipa Manunggal <tirtadwipa.manunggal@gmail.com>
8890
Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com>
91+
Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com>
8992
Utkarsh <http://utkarsh11105@gmail.com>
9093
Utkarsh Raj <rajutkarsh2505@gmail.com>
94+
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
9195
Varad Gupta <varadgupta21@gmail.com>
9296
Xiaochuan Ye <tap91624@gmail.com>
9397
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
@@ -96,3 +100,4 @@ nishant-s7 <97207366+nishant-s7@users.noreply.github.com>
96100
orimiles5 <97595296+orimiles5@users.noreply.github.com>
97101
rainn <88160429+AmCodesLame@users.noreply.github.com>
98102
rei2hu <reimu@reimu.ws>
103+
yaswanth <116426380+yaswanthkosuru@users.noreply.github.com>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
593593
[npm-image]: http://img.shields.io/npm/v/@stdlib/assert.svg
594594
[npm-url]: https://npmjs.org/package/@stdlib/assert
595595

596-
[test-image]: https://github.com/stdlib-js/assert/actions/workflows/test.yml/badge.svg?branch=v0.3.1
597-
[test-url]: https://github.com/stdlib-js/assert/actions/workflows/test.yml?query=branch:v0.3.1
596+
[test-image]: https://github.com/stdlib-js/assert/actions/workflows/test.yml/badge.svg?branch=main
597+
[test-url]: https://github.com/stdlib-js/assert/actions/workflows/test.yml?query=branch:main
598598

599599
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/assert/main.svg
600600
[coverage-url]: https://codecov.io/github/stdlib-js/assert?branch=main

is-same-array-like/README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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 array-like and have the [same values][@stdlib/assert/is-same-value].
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var isSameArrayLike = require( '@stdlib/assert/is-same-array-like' );
31+
```
32+
33+
#### isSameArrayLike( v1, v2 )
34+
35+
Tests if two arguments are both array-like and have the [same values][@stdlib/assert/is-same-value].
36+
37+
```javascript
38+
var x = [ 1.0, 2.0 ];
39+
var y = [ 1.0, 2.0 ];
40+
var bool = isSameArrayLike( x, y );
41+
// returns true
42+
43+
bool = isSameArrayLike( x, [ -1.0, 2.0 ] );
44+
// returns false
45+
```
46+
47+
</section>
48+
49+
<!-- /.usage -->
50+
51+
<section class="notes">
52+
53+
## Notes
54+
55+
- In contrast to the strict equality operator `===`, the function distinguishes between `+0` and `-0` and treats `NaNs` as the [same value][@stdlib/assert/is-same-value].
56+
57+
</section>
58+
59+
<!-- /.notes -->
60+
61+
<section class="examples">
62+
63+
## Examples
64+
65+
<!-- eslint no-undef: "error" -->
66+
67+
```javascript
68+
var isSameArrayLike = require( '@stdlib/assert/is-same-array-like' );
69+
70+
var x = [ 1.0, 2.0, 3.0 ];
71+
var y = [ 1.0, 2.0, 3.0 ];
72+
var out = isSameArrayLike( x, y );
73+
// returns true
74+
75+
x = [ -0.0, 0.0, -0.0 ];
76+
y = [ 0.0, -0.0, 0.0 ];
77+
out = isSameArrayLike( x, y );
78+
// returns false
79+
80+
x = [ NaN, NaN, NaN ];
81+
y = [ NaN, NaN, NaN ];
82+
out = isSameArrayLike( x, y );
83+
// returns true
84+
```
85+
86+
</section>
87+
88+
<!-- /.examples -->
89+
90+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
91+
92+
<section class="related">
93+
94+
</section>
95+
96+
<!-- /.related -->
97+
98+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
99+
100+
<section class="links">
101+
102+
[@stdlib/assert/is-same-value]: https://github.com/stdlib-js/assert/tree/main/is-same-value
103+
104+
<!-- <related-links> -->
105+
106+
<!-- </related-links> -->
107+
108+
</section>
109+
110+
<!-- /.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 zeroTo = require( '@stdlib/array/base/zero-to' );
27+
var pkg = require( './../package.json' ).name;
28+
var isSameArrayLike = 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 = zeroTo( len );
42+
var y = zeroTo( 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 = isSameArrayLike( 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();

is-same-array-like/docs/repl.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
{{alias}}( v1, v2 )
3+
Tests if two arguments are both array-like and have the same values.
4+
5+
The function differs from the `===` operator in that the function treats
6+
`-0` and `+0` as distinct and `NaNs` as the same.
7+
8+
Parameters
9+
----------
10+
v1: any
11+
First input value.
12+
13+
v2: any
14+
Second input value.
15+
16+
Returns
17+
-------
18+
bool: boolean
19+
Boolean indicating whether two arguments are the same.
20+
21+
Examples
22+
--------
23+
> var x = [ 1.0, 2.0, 3.0 ];
24+
> var y = [ 1.0, 2.0, 3.0 ];
25+
> var bool = {{alias}}( x, y )
26+
true
27+
28+
> x = [ NaN, NaN, NaN ];
29+
> y = [ NaN, NaN, NaN ];
30+
> bool = {{alias}}( x, y )
31+
true
32+
33+
See Also
34+
--------
35+

0 commit comments

Comments
 (0)