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 Jun 21, 2024
1 parent 400f4b2 commit 72a7bef
Show file tree
Hide file tree
Showing 12 changed files with 683 additions and 2 deletions.
25 changes: 24 additions & 1 deletion 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-06-05)
## Unreleased (2024-06-21)

<section class="packages">

Expand Down Expand Up @@ -1298,6 +1298,28 @@ This release closes the following issue:

<!-- /.package -->

<section class="package" id="assert-is-same-booleanarray-unreleased">

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

<details>

<section class="features">

##### Features

- [`a5c9e56`](https://github.com/stdlib-js/stdlib/commit/a5c9e56a3ea7198ae4fe3248d4bfaa9e1d19bfcd) - add `assert/is-same-booleanarray` [(#2401)](https://github.com/stdlib-js/stdlib/pull/2401)

</section>

<!-- /.features -->

</details>

</section>

<!-- /.package -->

<section class="package" id="assert-is-same-date-object-unreleased">

#### [@stdlib/assert/is-same-date-object](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-same-date-object)
Expand Down Expand Up @@ -1671,6 +1693,7 @@ A total of 10 people contributed to this release. Thank you to the following con

<details>

- [`a5c9e56`](https://github.com/stdlib-js/stdlib/commit/a5c9e56a3ea7198ae4fe3248d4bfaa9e1d19bfcd) - **feat:** add `assert/is-same-booleanarray` [(#2401)](https://github.com/stdlib-js/stdlib/pull/2401) _(by Jaysukh Makvana, Athan Reines)_
- [`7c36ea3`](https://github.com/stdlib-js/stdlib/commit/7c36ea3437d16b7ce4fd86d76636b5a5d77d04c3) - **feat:** add `assert/is-booleanarray` [(#2299)](https://github.com/stdlib-js/stdlib/pull/2299) _(by Jaysukh Makvana, Athan Reines)_
- [`3a3b1e0`](https://github.com/stdlib-js/stdlib/commit/3a3b1e08f73a54c5ee46d73045805aee0bb1196d) - **docs:** update package URLs [(##2269)](#2269) _(by stdlib-bot)_
- [`8089b88`](https://github.com/stdlib-js/stdlib/commit/8089b886a4d7d89f15abb068b1021d93f9c4f64e) - **docs:** update paths _(by Athan Reines)_
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Pushpendra Chandravanshi <[email protected]>
Raunak Kumar Gupta <[email protected]>
Rejoan Sardar <[email protected]>
Ricky Reusser <[email protected]>
Ridam Garg <[email protected]>
Robert Gislason <[email protected]>
Roman Stetsyk <[email protected]>
Rutam <[email protected]>
Expand All @@ -75,7 +76,7 @@ Shraddheya Shendre <[email protected]>
Shubh Mehta <[email protected]>
Shubham Mishra <[email protected]>
Sivam Das <[email protected]>
Snehil Shah <[email protected].com>
Snehil Shah <snehilshah.989@gmail.com>
Soumajit Chatterjee <[email protected]>
Spandan Barve <[email protected]>
Stephannie Jiménez Gacha <[email protected]>
Expand Down
102 changes: 102 additions & 0 deletions is-same-booleanarray/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<!--
@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.
-->

# isSameBooleanArray

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

## Usage

```javascript
var isSameBooleanArray = require( '@stdlib/assert/is-same-booleanarray' );
```

#### isSameBooleanArray( v1, v2 )

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

```javascript
var BooleanArray = require( '@stdlib/array/bool' );

var x = new BooleanArray( [ true, false ] );
var y = new BooleanArray( [ true, false ] );
var bool = isSameBooleanArray( x, y );
// returns true

bool = isSameBooleanArray( x, [ true, false ] );
// returns false
```

</section>

<!-- /.usage -->

<section class="notes">

</section>

<!-- /.notes -->

<section class="examples">

## Examples

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

```javascript
var BooleanArray = require( '@stdlib/array/bool' );
var isSameBooleanArray = require( '@stdlib/assert/is-same-booleanarray' );

var x = new BooleanArray( [ true, false, false, true ] );
var y = new BooleanArray( [ true, false, false, true ] );
var out = isSameBooleanArray( x, y );
// returns true

x = new BooleanArray( [ true, false, false, true ] );
y = new BooleanArray( [ true, true, false, false ] );
out = isSameBooleanArray( 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/bool]: https://github.com/stdlib-js/array-bool

[@stdlib/assert/is-same-value]: https://github.com/stdlib-js/assert/tree/main/is-same-value

</section>

<!-- /.links -->
106 changes: 106 additions & 0 deletions is-same-booleanarray/benchmark/benchmark.length.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/**
* @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 Boolean = require( '@stdlib/boolean/ctor' );
var BooleanArray = require( '@stdlib/array/bool' );
var pkg = require( './../package.json' ).name;
var isSameBooleanArray = require( './../lib' );


// FUNCTIONS //

/**
* Creates a benchmark function.
*
* @private
* @param {PositiveInteger} len - array length
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x;
var y;
var i;

x = [];
for ( i = 0; i < len; i++ ) {
x.push( Boolean( i%2 ) );
}
x = new BooleanArray( x );
y = new BooleanArray( x );

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 = isSameBooleanArray( 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();
32 changes: 32 additions & 0 deletions is-same-booleanarray/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 BooleanArrays 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 the same.

Examples
--------
> var x = new {{alias:@stdlib/array/bool}}( [ true, false, false, true ] );
> var y = new {{alias:@stdlib/array/bool}}( [ true, false, false, true ] );
> var bool = {{alias}}( x, y )
true

> x = new {{alias:@stdlib/array/bool}}( [ true, false, false, true ] );
> y = new {{alias:@stdlib/array/bool}}( [ true, true, false, false ] );
> bool = {{alias}}( x, y )
false

See Also
--------

51 changes: 51 additions & 0 deletions is-same-booleanarray/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* @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 BooleanArrays and have the same values.
*
* @param v1 - first input value
* @param v2 - second input value
* @returns boolean indicating whether two arguments are the same
*
* @example
* var BooleanArray = require( '@stdlib/array/bool' );
*
* var x = new BooleanArray( [ true, false, false, true ] );
* var y = new BooleanArray( [ true, false, false, true ] );
*
* var out = isSameBooleanArray( x, y );
* // returns true
*
* @example
* var BooleanArray = require( '@stdlib/array/bool' );
*
* var x = new BooleanArray( [ true, false, false, true ] );
* var y = new BooleanArray( [ true, true, false, false ] );
*
* var out = isSameBooleanArray( x, y );
* // returns false
*/
declare function isSameBooleanArray( v1: any, v2: any ): boolean;


// EXPORTS //

export = isSameBooleanArray;
36 changes: 36 additions & 0 deletions is-same-booleanarray/docs/types/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* @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.
*/

import isSameBooleanArray = require( './index' );


// TESTS //

// The function returns a boolean...
{
isSameBooleanArray( true, true ); // $ExpectType boolean
isSameBooleanArray( null, null ); // $ExpectType boolean
isSameBooleanArray( 'beep', 'boop' ); // $ExpectType boolean
}

// The compiler throws an error if the function is provided an unsupported number of arguments...
{
isSameBooleanArray(); // $ExpectError
isSameBooleanArray( 3.14 ); // $ExpectError
isSameBooleanArray( 'beep', 'beep', 3.14 ); // $ExpectError
}
Loading

0 comments on commit 72a7bef

Please sign in to comment.