From 219a4f6033c15ac682857dad0dd0decb1675e5af Mon Sep 17 00:00:00 2001 From: DiyanshuVortex Date: Sun, 9 Nov 2025 18:45:13 +0530 Subject: [PATCH 01/12] feat: add has-split-symbol-support --- .../assert/has-split-symbol-support/README.md | 138 +++++++++++++++ .../benchmark/benchmark.js | 49 ++++++ .../assert/has-split-symbol-support/bin/cli | 60 +++++++ .../has-split-symbol-support/docs/repl.txt | 18 ++ .../docs/types/index.d.ts | 35 ++++ .../docs/types/test.ts | 33 ++++ .../has-split-symbol-support/docs/usage.txt | 8 + .../etc/cli_opts.json | 14 ++ .../examples/index.js | 28 +++ .../has-split-symbol-support/lib/index.js | 40 +++++ .../has-split-symbol-support/lib/main.js | 50 ++++++ .../has-split-symbol-support/package.json | 75 ++++++++ .../has-split-symbol-support/test/test.cli.js | 163 ++++++++++++++++++ .../has-split-symbol-support/test/test.js | 66 +++++++ 14 files changed, 777 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/bin/cli create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/usage.txt create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/etc/cli_opts.json create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/examples/index.js create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/index.js create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/main.js create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/package.json create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.cli.js create mode 100644 lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.js diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md b/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md new file mode 100644 index 000000000000..3ec75883b725 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md @@ -0,0 +1,138 @@ + + +# Iterator Symbol Support + +> Detect native [`Symbol.split`][mdn-split-symbol] support. + +
+ +## Usage + +```javascript +var hasSplitSymbolSupport = require( '@stdlib/assert/has-split-symbol-support' ); +``` + +#### hasSplitSymbolSupport() + +Detects if a runtime environment supports ES2015 [`Symbol.split`][mdn-split-symbol]. + +```javascript +var bool = hasSplitSymbolSupport(); +// returns +``` + +
+ + + +
+ +## Examples + + + +```javascript +var hasSplitSymbolSupport = require( '@stdlib/assert/has-split-symbol-support' ); + +var bool = hasSplitSymbolSupport(); +if ( bool ) { + console.log( 'Environment has Symbol.split support.' ); +} else { + console.log( 'Environment lacks Symbol.split support.' ); +} +``` + +
+ + + +* * * + +
+ +## CLI + +
+ +### Usage + +```text +Usage: has-split-symbol-support [options] + +Options: + + -h, --help Print this message. + -V, --version Print the package version. +``` + +
+ + + +
+ +### Examples + +```bash +$ has-split-symbol-support + +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/benchmark/benchmark.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/benchmark/benchmark.js new file mode 100644 index 000000000000..c0b14e8054b4 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/benchmark/benchmark.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var hasSplitSymbolSupport = 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 = hasSplitSymbolSupport(); + 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(); +}); diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/bin/cli b/lib/node_modules/@stdlib/assert/has-split-symbol-support/bin/cli new file mode 100644 index 000000000000..01a42fc68af5 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/bin/cli @@ -0,0 +1,60 @@ +#!/usr/bin/env node + +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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(); diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/repl.txt b/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/repl.txt new file mode 100644 index 000000000000..4e81db5a6688 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/repl.txt @@ -0,0 +1,18 @@ + +{{alias}}() + Tests for native `Symbol.split` support. + + Returns + ------- + bool: boolean + Boolean indicating if an environment has native `Symbol.split` + support. + + Examples + -------- + > var bool = {{alias}}() + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/types/index.d.ts new file mode 100644 index 000000000000..752eff2d0de2 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2019 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 `Symbol.split` support. +* +* @returns boolean indicating if an environment has `Symbol.split` support +* +* @example +* var bool = hasSplitSymbolSupport(); +* // returns +*/ +declare function hasSplitSymbolSupport(): boolean; + + +// EXPORTS // + +export = hasSplitSymbolSupport; diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/types/test.ts b/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/types/test.ts new file mode 100644 index 000000000000..107a5158d7f8 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/types/test.ts @@ -0,0 +1,33 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2019 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 hasSplitSymbolSupport = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + hasSplitSymbolSupport(); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided arguments... +{ + hasSplitSymbolSupport( true ); // $ExpectError + hasSplitSymbolSupport( [], 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/usage.txt b/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/usage.txt new file mode 100644 index 000000000000..efc36cdd4815 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/docs/usage.txt @@ -0,0 +1,8 @@ + +Usage: has-split-symbol-support [options] + +Options: + + -h, --help Print this message. + -V, --version Print the package version. + diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/etc/cli_opts.json b/lib/node_modules/@stdlib/assert/has-split-symbol-support/etc/cli_opts.json new file mode 100644 index 000000000000..f245a17e6317 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/etc/cli_opts.json @@ -0,0 +1,14 @@ +{ + "boolean": [ + "help", + "version" + ], + "alias": { + "help": [ + "h" + ], + "version": [ + "V" + ] + } +} diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/examples/index.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/examples/index.js new file mode 100644 index 000000000000..ed736d013869 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/examples/index.js @@ -0,0 +1,28 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +var hasSplitSymbolSupport = require( './../lib' ); + +var bool = hasSplitSymbolSupport(); +if ( bool ) { + console.log( 'Environment has Symbol.split support.' ); +} else { + console.log( 'Environment lacks Symbol.split support.' ); +} diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/index.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/index.js new file mode 100644 index 000000000000..2501505b1152 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Test for native `Symbol.split` support. +* +* @module @stdlib/assert/has-split-symbol-support +* +* @example +* var hasSplitSymbolSupport = require( '@stdlib/assert/has-split-symbol-support' ); +* +* var bool = hasSplitSymbolSupport(); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/main.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/main.js new file mode 100644 index 000000000000..89827d7b6b27 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/main.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var Symbol = require( '@stdlib/symbol/ctor' ); + + +// MAIN // + +/** +* Tests for native `Symbol.split` support. +* +* @returns {boolean} boolean indicating if an environment has `Symbol.split` support +* +* @example +* var bool = hasSplitSymbolSupport(); +* // returns +*/ +function hasSplitSymbolSupport() { + return ( + typeof Symbol === 'function' && + typeof Symbol( 'foo' ) === 'symbol' && + hasOwnProp( Symbol, 'split' ) && + typeof Symbol.split === 'symbol' + ); +} + + +// EXPORTS // + +module.exports = hasSplitSymbolSupport; diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/package.json b/lib/node_modules/@stdlib/assert/has-split-symbol-support/package.json new file mode 100644 index 000000000000..8cfd0ddafc60 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/package.json @@ -0,0 +1,75 @@ +{ + "name": "@stdlib/assert/has-split-symbol-support", + "version": "0.0.0", + "description": "Detect native Symbol.split support.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "bin": { + "has-split-symbol-support": "./bin/cli" + }, + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdutils", + "stdutil", + "utilities", + "utility", + "utils", + "util", + "detect", + "feature", + "symbol", + "split", + "symbol.split", + "es2015", + "es6", + "support", + "has", + "native", + "issupported", + "cli" + ] +} diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.cli.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.cli.js new file mode 100644 index 000000000000..8e6986e5a2b9 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.cli.js @@ -0,0 +1,163 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 exec = require( 'child_process' ).exec; +var tape = require( 'tape' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); +var EXEC_PATH = require( '@stdlib/process/exec-path' ); +var readFileSync = require( '@stdlib/fs/read-file' ).sync; + + +// VARIABLES // + +var fpath = resolve( __dirname, '..', 'bin', 'cli' ); +var opts = { + 'skip': IS_BROWSER || IS_WINDOWS +}; + + +// FIXTURES // + +var PKG_VERSION = require( './../package.json' ).version; + + +// TESTS // + +tape( 'command-line interface', function test( t ) { + t.ok( true, __filename ); + t.end(); +}); + +tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { + var expected; + var cmd; + + expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { + 'encoding': 'utf8' + }); + cmd = [ + EXEC_PATH, + fpath, + '--help' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); + } + t.end(); + } +}); + +tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { + var expected; + var cmd; + + expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { + 'encoding': 'utf8' + }); + cmd = [ + EXEC_PATH, + fpath, + '-h' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); + } + t.end(); + } +}); + +tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { + var cmd = [ + EXEC_PATH, + fpath, + '--version' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); + } + t.end(); + } +}); + +tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { + var cmd = [ + EXEC_PATH, + fpath, + '-V' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); + } + t.end(); + } +}); + +tape( 'the command-line interface prints either `true` or `false` to `stdout` indicating whether an environment provides native `Symbol.split` support', opts, function test( t ) { + var cmd = [ + EXEC_PATH, + fpath + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + var str; + if ( error ) { + t.fail( error.message ); + } else { + str = stdout.toString(); + t.strictEqual( str === 'true\n' || str === 'false\n', true, 'prints either `true` or `false` to `stdout`' ); + t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); + } + t.end(); + } +}); diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.js new file mode 100644 index 000000000000..58ce82780bf1 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var Symbol = require( '@stdlib/symbol/ctor' ); +var detect = require( './../lib' ); + + +// VARIABLES // + +var hasSplitSymbol = ( typeof Symbol === 'function' && typeof Symbol.split === 'symbol' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof detect, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'feature detection result is a boolean', function test( t ) { + t.strictEqual( typeof detect(), 'boolean', 'detection result is a boolean' ); + t.end(); +}); + +tape( 'if `Symbol.split` is supported, detection result is `true`', function test( t ) { + if ( hasSplitSymbol ) { + t.strictEqual( detect(), true, 'detection result is `true`' ); + } else { + t.strictEqual( detect(), false, 'detection result is `false`' ); + } + t.end(); +}); + +tape( 'the function guards against a `Symbol` global variable which does not produce `symbols`', function test( t ) { + var detect = proxyquire( './../lib/main.js', { + '@stdlib/symbol/ctor': mock + }); + t.strictEqual( detect(), false, 'detection result is `false`' ); + t.end(); + + function mock() { + return {}; + } +}); From 3dce77c3efd8795c95dcbdf5c17151e6bcfc3b64 Mon Sep 17 00:00:00 2001 From: DiyanshuVortex Date: Mon, 10 Nov 2025 09:59:38 +0530 Subject: [PATCH 02/12] feat: add assert/has-split-symbol-support fixed linting error --- .../@stdlib/assert/has-split-symbol-support/README.md | 4 ++-- .../assert/has-split-symbol-support/docs/types/index.d.ts | 2 +- .../assert/has-split-symbol-support/docs/types/test.ts | 2 +- .../@stdlib/assert/has-split-symbol-support/lib/main.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md b/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md index 3ec75883b725..88a8dd19f14c 100644 --- a/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2018 The Stdlib Authors. +Copyright (c) 2025 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. @@ -123,7 +123,7 @@ $ has-split-symbol-support From 50cbfe5e09815f7c725f0ef2228ba88bedaf5547 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 9 Nov 2025 20:37:33 -0800 Subject: [PATCH 05/12] docs: fix copyright year Signed-off-by: Athan --- .../@stdlib/assert/has-split-symbol-support/bin/cli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/bin/cli b/lib/node_modules/@stdlib/assert/has-split-symbol-support/bin/cli index 01a42fc68af5..8520ae55bf89 100644 --- a/lib/node_modules/@stdlib/assert/has-split-symbol-support/bin/cli +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/bin/cli @@ -3,7 +3,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. From 9a9521e1045de5641ebd9794bab4e3b209dcf24a Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 9 Nov 2025 20:38:25 -0800 Subject: [PATCH 06/12] docs: fix copyright year Signed-off-by: Athan --- .../@stdlib/assert/has-split-symbol-support/examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/examples/index.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/examples/index.js index ed736d013869..1fba4292cf3b 100644 --- a/lib/node_modules/@stdlib/assert/has-split-symbol-support/examples/index.js +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. From 686f27e28837cdfc9306665ba5390d47443ad77c Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 9 Nov 2025 20:38:56 -0800 Subject: [PATCH 07/12] docs: fix copyright year Signed-off-by: Athan --- .../@stdlib/assert/has-split-symbol-support/lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/index.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/index.js index 2501505b1152..56d18598c649 100644 --- a/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/index.js +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. From 9008b191a15b9c925c859f296f6743cdc0dfcae9 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 9 Nov 2025 20:39:22 -0800 Subject: [PATCH 08/12] docs: fix copyright year Signed-off-by: Athan --- .../@stdlib/assert/has-split-symbol-support/lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/main.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/main.js index 7106d2aa7002..0bc6a35dae59 100644 --- a/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/main.js +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. From f26eb5b5fa304f80118345408cc5280e1a56c038 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 9 Nov 2025 20:40:03 -0800 Subject: [PATCH 09/12] docs: fix copyright year Signed-off-by: Athan --- .../@stdlib/assert/has-split-symbol-support/test/test.cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.cli.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.cli.js index 8e6986e5a2b9..96c71f2642ee 100644 --- a/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.cli.js +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.cli.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. From 1b52ac08d25202e6bd30e5f794b37ab10ef6e906 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 9 Nov 2025 20:40:25 -0800 Subject: [PATCH 10/12] docs: fix copyright year Signed-off-by: Athan --- .../assert/has-split-symbol-support/benchmark/benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/benchmark/benchmark.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/benchmark/benchmark.js index c0b14e8054b4..3bcf309e1f2f 100644 --- a/lib/node_modules/@stdlib/assert/has-split-symbol-support/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. From 33f16667edb4e884d98205a3c8ced4678e75eca4 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 9 Nov 2025 20:41:05 -0800 Subject: [PATCH 11/12] docs: fix copyright year Signed-off-by: Athan --- .../@stdlib/assert/has-split-symbol-support/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.js b/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.js index 58ce82780bf1..a645bca88656 100644 --- a/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.js +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. From 3209086a3b9f39539ee764612c8e88f7c8649c19 Mon Sep 17 00:00:00 2001 From: DiyanshuVortex Date: Mon, 10 Nov 2025 10:11:28 +0530 Subject: [PATCH 12/12] feat: add assert/has-split-symbol-support fixed linting error --- .../assert/has-split-symbol-support/README.md | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md b/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md index 88a8dd19f14c..cdc86fc111f3 100644 --- a/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md +++ b/lib/node_modules/@stdlib/assert/has-split-symbol-support/README.md @@ -18,7 +18,7 @@ limitations under the License. --> -# Iterator Symbol Support +# Split Symbol Support > Detect native [`Symbol.split`][mdn-split-symbol] support. @@ -108,13 +108,6 @@ $ has-split-symbol-support @@ -125,14 +118,6 @@ $ has-split-symbol-support [mdn-split-symbol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/split - - -[@stdlib/assert/has-async-iterator-symbol-support]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-async-iterator-symbol-support - -[@stdlib/assert/has-symbol-support]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-symbol-support - - -