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 Sep 9, 2024
1 parent 29a487d commit d80053e
Show file tree
Hide file tree
Showing 32 changed files with 1,730 additions and 0 deletions.
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

##### Features

- [`e97215f`](https://github.com/stdlib-js/stdlib/commit/e97215fbf9f4d1ec8548086f78ed04a0ec80a43f) - add `hasBtoaSupport` to namespace
- [`80b8061`](https://github.com/stdlib-js/stdlib/commit/80b8061c5888d04dcaa48f0363669ba2606856df) - add `hasAtobSupport` to namespace
- [`1123204`](https://github.com/stdlib-js/stdlib/commit/11232044680f87bb3b53b447dab24e4e54b659ef) - add `isEqualArray` to namespace
- [`d64eaf8`](https://github.com/stdlib-js/stdlib/commit/d64eaf86a770b6d7fad0078d65afe7e2a79361cb) - add `isSameArrayLike` to namespace

Expand All @@ -33,6 +35,50 @@

<!-- /.package -->

<section class="package" id="assert-has-atob-support-unreleased">

#### [@stdlib/assert/has-atob-support](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-atob-support)

<details>

<section class="features">

##### Features

- [`f8e39ea`](https://github.com/stdlib-js/stdlib/commit/f8e39ea1a6d25ebb156f0d37219c6680d87c454f) - add `assert/has-atob-support`

</section>

<!-- /.features -->

</details>

</section>

<!-- /.package -->

<section class="package" id="assert-has-btoa-support-unreleased">

#### [@stdlib/assert/has-btoa-support](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-btoa-support)

<details>

<section class="features">

##### Features

- [`33219ce`](https://github.com/stdlib-js/stdlib/commit/33219cecbc347a85b4bb9659d00005fe7b5a6e64) - add `assert/has-btoa-support`

</section>

<!-- /.features -->

</details>

</section>

<!-- /.package -->

<section class="package" id="assert-is-equal-array-unreleased">

#### [@stdlib/assert/is-equal-array](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-equal-array)
Expand Down Expand Up @@ -99,6 +145,10 @@ A total of 1 person contributed to this release. Thank you to this contributor:

<details>

- [`e97215f`](https://github.com/stdlib-js/stdlib/commit/e97215fbf9f4d1ec8548086f78ed04a0ec80a43f) - **feat:** add `hasBtoaSupport` to namespace _(by Athan Reines)_
- [`33219ce`](https://github.com/stdlib-js/stdlib/commit/33219cecbc347a85b4bb9659d00005fe7b5a6e64) - **feat:** add `assert/has-btoa-support` _(by Athan Reines)_
- [`80b8061`](https://github.com/stdlib-js/stdlib/commit/80b8061c5888d04dcaa48f0363669ba2606856df) - **feat:** add `hasAtobSupport` to namespace _(by Athan Reines)_
- [`f8e39ea`](https://github.com/stdlib-js/stdlib/commit/f8e39ea1a6d25ebb156f0d37219c6680d87c454f) - **feat:** add `assert/has-atob-support` _(by Athan Reines)_
- [`1123204`](https://github.com/stdlib-js/stdlib/commit/11232044680f87bb3b53b447dab24e4e54b659ef) - **feat:** add `isEqualArray` to namespace _(by Athan Reines)_
- [`c992288`](https://github.com/stdlib-js/stdlib/commit/c99228859333cce71cb2f913aa8acb2020cda9a0) - **feat:** add `assert/is-equal-array` _(by Athan Reines)_
- [`d64eaf8`](https://github.com/stdlib-js/stdlib/commit/d64eaf86a770b6d7fad0078d65afe7e2a79361cb) - **feat:** add `isSameArrayLike` to namespace _(by Athan Reines)_
Expand Down
123 changes: 123 additions & 0 deletions has-atob-support/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<!--
@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.
-->

# hasAtobSupport

> Detect native [`atob`][mdn-atob] support.
<section class="usage">

## Usage

```javascript
var hasAtobSupport = require( '@stdlib/assert/has-atob-support' );
```

#### hasAtobSupport()

Detects if a runtime environment supports [`atob`][mdn-atob].

```javascript
var bool = hasAtobSupport();
// returns <boolean>
```

</section>

<!-- /.usage -->

<section class="examples">

## Examples

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

```javascript
var hasAtobSupport = require( '@stdlib/assert/has-atob-support' );

var bool = hasAtobSupport();
if ( bool ) {
console.log( 'Environment has atob support.' );
} else {
console.log( 'Environment lacks atob support.' );
}
```

</section>

<!-- /.examples -->

* * *

<section class="cli">

## CLI

<section class="usage">

### Usage

```text
Usage: has-atob-support [options]
Options:
-h, --help Print this message.
-V, --version Print the package version.
```

</section>

<!-- /.usage -->

<section class="examples">

### Examples

```bash
$ has-atob-support
<boolean>
```

</section>

<!-- /.examples -->

</section>

<!-- /.cli -->

<!-- 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">

[mdn-atob]: https://developer.mozilla.org/en-US/docs/Web/API/Window/atob

</section>

<!-- /.links -->
49 changes: 49 additions & 0 deletions has-atob-support/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* @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 pkg = require( './../package.json' ).name;
var hasAtobSupport = require( './../lib' );


// MAIN //

bench( pkg, function benchmark( b ) {
var bool;
var i;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
// Note: the following *could* be optimized away via loop-invariant code motion. If so, the entire loop will disappear.
bool = hasAtobSupport();
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();
});
60 changes: 60 additions & 0 deletions has-atob-support/bin/cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env node

/**
* @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 resolve = require( 'path' ).resolve;
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
var CLI = require( '@stdlib/cli/ctor' );
var detect = require( './../lib' );


// MAIN //

/**
* Main execution sequence.
*
* @private
*/
function main() {
var flags;
var cli;

// Create a command-line interface:
cli = new CLI({
'pkg': require( './../package.json' ),
'options': require( './../etc/cli_opts.json' ),
'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), {
'encoding': 'utf8'
})
});

// Get any provided command-line options:
flags = cli.flags();
if ( flags.help || flags.version ) {
return;
}

console.log( detect() ); // eslint-disable-line no-console
}

main();
17 changes: 17 additions & 0 deletions has-atob-support/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

{{alias}}()
Tests for native `atob` support.

Returns
-------
bool: boolean
Boolean indicating if an environment has `atob` support.

Examples
--------
> var bool = {{alias}}()
<boolean>

See Also
--------

35 changes: 35 additions & 0 deletions has-atob-support/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* @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 for native `atob` support.
*
* @returns boolean indicating if an environment has `atob` support
*
* @example
* var bool = hasAtobSupport();
* // returns <boolean>
*/
declare function hasAtobSupport(): boolean;


// EXPORTS //

export = hasAtobSupport;
33 changes: 33 additions & 0 deletions has-atob-support/docs/types/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* @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 hasAtobSupport = require( './index' );


// TESTS //

// The function returns a boolean...
{
hasAtobSupport(); // $ExpectType boolean
}

// The compiler throws an error if the function is provided arguments...
{
hasAtobSupport( true ); // $ExpectError
hasAtobSupport( [], 123 ); // $ExpectError
}
Loading

0 comments on commit d80053e

Please sign in to comment.