From bd378cfe700282df874da474172f5230a91728d0 Mon Sep 17 00:00:00 2001 From: Aditya Date: Mon, 10 Nov 2025 23:50:16 +0530 Subject: [PATCH 1/2] Implemented Symbol.split package as per RFC requirements --- .../@stdlib/symbol/split/README.md | 75 ++++++++++++++++++ .../@stdlib/symbol/split/lib/browser.js | 37 +++++++++ lib/node_modules/@stdlib/symbol/split/main.js | 37 +++++++++ .../@stdlib/symbol/split/package.json | 79 +++++++++++++++++++ .../@stdlib/symbol/split/test/test.js | 61 ++++++++++++++ 5 files changed, 289 insertions(+) create mode 100644 lib/node_modules/@stdlib/symbol/split/README.md create mode 100644 lib/node_modules/@stdlib/symbol/split/lib/browser.js create mode 100644 lib/node_modules/@stdlib/symbol/split/main.js create mode 100644 lib/node_modules/@stdlib/symbol/split/package.json create mode 100644 lib/node_modules/@stdlib/symbol/split/test/test.js diff --git a/lib/node_modules/@stdlib/symbol/split/README.md b/lib/node_modules/@stdlib/symbol/split/README.md new file mode 100644 index 000000000000..e0efedf6741a --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/split/README.md @@ -0,0 +1,75 @@ + + +# Symbol.split + +> The well-known symbol `Symbol.split`. + +
+ +## Usage + +```javascript +var hasSplitSupport = require( '@stdlib/assert/has-symbol-support' )(); +var split = require( '@stdlib/symbol/split' ); + +var bool = ( typeof split === 'symbol' ); +// returns +``` + +
+ + + +
+ +## Examples + + + +```javascript +var hasSplitSupport = require( '@stdlib/assert/has-symbol-support' )(); +var split = require( '@stdlib/symbol/split' ); + +if ( hasSplitSupport ) { + console.log( split === Symbol.split ); + // => true +} else { + console.log( '@stdlib/symbol/split' ); +} +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/symbol/split/lib/browser.js b/lib/node_modules/@stdlib/symbol/split/lib/browser.js new file mode 100644 index 000000000000..3c515a19a05e --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/split/lib/browser.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +// MAIN // + +/** +* The well-known symbol `@@split`. +* +* @constant +* @name SPLIT +* @type {symbol} +* @see [MDN]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/split} +* @default Symbol.split +*/ +var SPLIT = ( typeof Symbol === 'function' && typeof Symbol.split === 'symbol' ) ? Symbol.split : '@@split'; // eslint-disable-line no-undef + + +// EXPORTS // + +module.exports = SPLIT; diff --git a/lib/node_modules/@stdlib/symbol/split/main.js b/lib/node_modules/@stdlib/symbol/split/main.js new file mode 100644 index 000000000000..3c515a19a05e --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/split/main.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +// MAIN // + +/** +* The well-known symbol `@@split`. +* +* @constant +* @name SPLIT +* @type {symbol} +* @see [MDN]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/split} +* @default Symbol.split +*/ +var SPLIT = ( typeof Symbol === 'function' && typeof Symbol.split === 'symbol' ) ? Symbol.split : '@@split'; // eslint-disable-line no-undef + + +// EXPORTS // + +module.exports = SPLIT; diff --git a/lib/node_modules/@stdlib/symbol/split/package.json b/lib/node_modules/@stdlib/symbol/split/package.json new file mode 100644 index 000000000000..aee3051fc9d2 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/split/package.json @@ -0,0 +1,79 @@ +{ + "name": "@stdlib/symbol/split", + "version": "0.0.0", + "description": "The well-known symbol `Symbol.split`. ", + "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" + } + ], + "main": "./lib", + "directories": { + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "scripts": { + "test": "make test", + "test-cov": "make test-cov", + "examples": "make examples" + }, + "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": { + "@stdlib/assert/has-symbol-support": "^0.0.0" + }, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "posix", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdtypes", + "types", + "utils", + "util", + "utilities", + "utility", + "es6", + "es2015", + "ecmascript", + "symbol", + "symbols", + "split", + "regexp", + "regex", + "regexp.split", + "string.split" + ], + "__stdlib__": {}, + "browser": { + "./lib/main.js": "./lib/browser.js" + } +} diff --git a/lib/node_modules/@stdlib/symbol/split/test/test.js b/lib/node_modules/@stdlib/symbol/split/test/test.js new file mode 100644 index 000000000000..8d9442358045 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/split/test/test.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 hasSymbolSupport = require( '@stdlib/assert/has-symbol-support' )(); +var SPLIT = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a symbol or string', function test( t ) { + t.ok( typeof SPLIT === 'symbol' || typeof SPLIT === 'string', 'main export is a symbol or string' ); + t.end(); +}); + +tape( 'if environment has `Symbol` support, the export is a symbol', function test( t ) { + if ( hasSymbolSupport ) { + t.equal( typeof SPLIT, 'symbol', 'is a symbol' ); + } + t.end(); +}); + +tape( 'if environment does not have `Symbol` support, the export is a string', function test( t ) { + if ( !hasSymbolSupport ) { + t.equal( typeof SPLIT, 'string', 'is a string' ); + } + t.end(); +}); + +tape( 'the export equals `Symbol.split` if environment has `Symbol` support', function test( t ) { + if ( hasSymbolSupport ) { + t.equal( SPLIT, Symbol.split, 'equals Symbol.split' ); + } + t.end(); +}); + +tape( 'the export equals `'@@split'` if environment does not have `Symbol` support', function test( t ) { + if ( !hasSymbolSupport ) { + t.equal( SPLIT, '@@split', 'equals @@split' ); + } + t.end(); +}); From b070aa2b1238f22912cb371d056a36e6e222805f Mon Sep 17 00:00:00 2001 From: Aditya Date: Tue, 11 Nov 2025 00:03:56 +0530 Subject: [PATCH 2/2] test --- .github/workflows/run_tests_coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests_coverage.yml b/.github/workflows/run_tests_coverage.yml index 3c892088c80f..a4699429d644 100644 --- a/.github/workflows/run_tests_coverage.yml +++ b/.github/workflows/run_tests_coverage.yml @@ -120,7 +120,7 @@ jobs: # Pin action to full length commit SHA uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: - node-version: 20 # 'lts/*' + node-version: 16 # Using Node.js 16 to match project's test matrix timeout-minutes: 5 # Cache dependencies: