Skip to content

Commit 29a487d

Browse files
committed
Auto-generated commit
1 parent 5cee291 commit 29a487d

File tree

12 files changed

+696
-1
lines changed

12 files changed

+696
-1
lines changed

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

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

99
<section class="packages">
1010

@@ -20,6 +20,7 @@
2020

2121
##### Features
2222

23+
- [`1123204`](https://github.com/stdlib-js/stdlib/commit/11232044680f87bb3b53b447dab24e4e54b659ef) - add `isEqualArray` to namespace
2324
- [`d64eaf8`](https://github.com/stdlib-js/stdlib/commit/d64eaf86a770b6d7fad0078d65afe7e2a79361cb) - add `isSameArrayLike` to namespace
2425

2526
</section>
@@ -32,6 +33,28 @@
3233

3334
<!-- /.package -->
3435

36+
<section class="package" id="assert-is-equal-array-unreleased">
37+
38+
#### [@stdlib/assert/is-equal-array](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-equal-array)
39+
40+
<details>
41+
42+
<section class="features">
43+
44+
##### Features
45+
46+
- [`c992288`](https://github.com/stdlib-js/stdlib/commit/c99228859333cce71cb2f913aa8acb2020cda9a0) - add `assert/is-equal-array`
47+
48+
</section>
49+
50+
<!-- /.features -->
51+
52+
</details>
53+
54+
</section>
55+
56+
<!-- /.package -->
57+
3558
<section class="package" id="assert-is-same-array-like-unreleased">
3659

3760
#### [@stdlib/assert/is-same-array-like](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-same-array-like)
@@ -76,6 +99,8 @@ A total of 1 person contributed to this release. Thank you to this contributor:
7699

77100
<details>
78101

102+
- [`1123204`](https://github.com/stdlib-js/stdlib/commit/11232044680f87bb3b53b447dab24e4e54b659ef) - **feat:** add `isEqualArray` to namespace _(by Athan Reines)_
103+
- [`c992288`](https://github.com/stdlib-js/stdlib/commit/c99228859333cce71cb2f913aa8acb2020cda9a0) - **feat:** add `assert/is-equal-array` _(by Athan Reines)_
79104
- [`d64eaf8`](https://github.com/stdlib-js/stdlib/commit/d64eaf86a770b6d7fad0078d65afe7e2a79361cb) - **feat:** add `isSameArrayLike` to namespace _(by Athan Reines)_
80105
- [`4e4d18d`](https://github.com/stdlib-js/stdlib/commit/4e4d18d142ca65c1257c2e2b7fa979dbbafb4741) - **feat:** add `assert/is-same-array-like` _(by Athan Reines)_
81106

is-equal-array/README.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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+
# isEqualArray
22+
23+
> Test if two arguments are both generic arrays and have equal values.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var isEqualArray = require( '@stdlib/assert/is-equal-array' );
31+
```
32+
33+
#### isEqualArray( v1, v2 )
34+
35+
Tests if two arguments are both generic arrays and have equal values.
36+
37+
```javascript
38+
var x = [ 1.0, 2.0 ];
39+
var y = [ 1.0, 2.0 ];
40+
var bool = isEqualArray( x, y );
41+
// returns true
42+
43+
bool = isEqualArray( 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+
- The function performs strict equality comparison; thus, the function treats `-0` and `+0` as equal and `NaNs` as distinct.
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 isEqualArray = require( '@stdlib/assert/is-equal-array' );
69+
70+
var x = [ 1.0, 2.0, 3.0 ];
71+
var y = [ 1.0, 2.0, 3.0 ];
72+
var out = isEqualArray( x, y );
73+
// returns true
74+
75+
x = [ -0.0, 0.0, -0.0 ];
76+
y = [ 0.0, -0.0, 0.0 ];
77+
out = isEqualArray( x, y );
78+
// returns true
79+
80+
x = [ NaN, NaN, NaN ];
81+
y = [ NaN, NaN, NaN ];
82+
out = isEqualArray( x, y );
83+
// returns false
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+
<!-- <related-links> -->
103+
104+
<!-- </related-links> -->
105+
106+
</section>
107+
108+
<!-- /.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 isEqualArray = 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 = isEqualArray( 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-equal-array/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 generic arrays and have equal values.
4+
5+
The function performs strict equality comparison; thus, the function treats
6+
`-0` and `+0` as equal and `NaNs` as distinct.
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 equal.
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+
false
32+
33+
See Also
34+
--------
35+

is-equal-array/docs/types/index.d.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 generic arrays and have equal values.
23+
*
24+
* ## Notes
25+
*
26+
* - The function performs strict equality comparison; thus, the function treats `-0` and `+0` as equal and `NaNs` as distinct.
27+
*
28+
* @param v1 - first input value
29+
* @param v2 - second input value
30+
* @returns boolean indicating whether two arguments are equal
31+
*
32+
* @example
33+
* var x = [ 1.0, 2.0, 3.0 ];
34+
* var y = [ 1.0, 2.0, 3.0 ];
35+
*
36+
* var out = isEqualArray( x, y );
37+
* // returns true
38+
*
39+
* @example
40+
* var x = [ 1.0, 2.0, 3.0 ];
41+
* var y = [ 1.0, 2.0, 4.0 ];
42+
*
43+
* var out = isEqualArray( x, y );
44+
* // returns false
45+
*/
46+
declare function isEqualArray( v1: any, v2: any ): boolean;
47+
48+
49+
// EXPORTS //
50+
51+
export = isEqualArray;

is-equal-array/docs/types/test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
import isEqualArray = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isEqualArray( 3.14, 3.14 ); // $ExpectType boolean
27+
isEqualArray( null, null ); // $ExpectType boolean
28+
isEqualArray( 'beep', 'boop' ); // $ExpectType boolean
29+
}
30+
31+
// The compiler throws an error if the function is provided an unsupported number of arguments...
32+
{
33+
isEqualArray(); // $ExpectError
34+
isEqualArray( 3.14 ); // $ExpectError
35+
isEqualArray( 'beep', 'beep', 3.14 ); // $ExpectError
36+
}

0 commit comments

Comments
 (0)