From 6d513bc52e6d9283361dbe02c0cc37179795553b Mon Sep 17 00:00:00 2001 From: Aditya Raut Date: Mon, 10 Nov 2025 17:58:26 +0530 Subject: [PATCH 1/3] fix(example): update example code Signed-off-by: Saloni Tarone --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/symbol/match/REDEME.md | 143 ++++++++++++++++++ .../@stdlib/symbol/match/docs/repl.txt | 19 +++ .../symbol/match/docs/types/index.d.ts | 31 ++++ .../@stdlib/symbol/match/docs/types/test.ts | 29 ++++ .../@stdlib/symbol/match/examples/index.js | 51 +++++++ .../@stdlib/symbol/match/lib/index.js | 49 ++++++ .../@stdlib/symbol/match/lib/main.js | 54 +++++++ .../@stdlib/symbol/match/package.json | 57 +++++++ .../@stdlib/symbol/match/test/test.js | 52 +++++++ 9 files changed, 485 insertions(+) create mode 100644 lib/node_modules/@stdlib/symbol/match/REDEME.md create mode 100644 lib/node_modules/@stdlib/symbol/match/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/symbol/match/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/symbol/match/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/symbol/match/examples/index.js create mode 100644 lib/node_modules/@stdlib/symbol/match/lib/index.js create mode 100644 lib/node_modules/@stdlib/symbol/match/lib/main.js create mode 100644 lib/node_modules/@stdlib/symbol/match/package.json create mode 100644 lib/node_modules/@stdlib/symbol/match/test/test.js diff --git a/lib/node_modules/@stdlib/symbol/match/REDEME.md b/lib/node_modules/@stdlib/symbol/match/REDEME.md new file mode 100644 index 000000000000..fc63f899cad3 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/match/REDEME.md @@ -0,0 +1,143 @@ + + +# MatchSymbol + +> Match [symbol][mdn-symbol] which is used to determine if a constructor object recognizes an object as its instance. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var MatchSymbol = require( '@stdlib/symbol/match' ); +``` + +#### MatchSymbol + +Match [`symbol`][mdn-symbol] which is used to determine if a constructor object recognizes an object as its instance. + +```javascript +var s = typeof MatchSymbol; +// e.g., returns 'symbol' +``` + +
+ + + + + +
+ +## Notes + +- The [symbol][mdn-symbol] is only supported in environments which support [symbols][mdn-symbol]. In non-supporting environments, the value is `null`. + +- The `instanceof` operator uses the following algorithm to determine the return value of `object instanceof constructor`: + + - If `constructor` has a `[MatchSymbol]()` method, the `instanceof` operator calls the method with `object` as the first argument and returns the result (coerced to a boolean). If `constructor` is not an object or if `constructor[MatchSymbol]` is neither `null`, `undefined`, nor a function, the `instanceof` operator raises an exception. + - Otherwise, if `constructor` does not have a `[MatchSymbol]()` method (i.e., `constructor[MatchSymbol]` is `null` or `undefined`), the `instanceof` operator determines the result using the same algorithm as `Function.prototype[MatchSymbol]()`. If `constructor` is not a function, the `instanceof` operator raises an exception. + +
+ + + + + +
+ +## Examples + + + +```javascript +var isArray = require( '@stdlib/assert/is-array' ); +var instanceOf = require( '@stdlib/assert/instance-of' ); +var defineProperty = require( '@stdlib/utils/define-property' ); +var MatchSymbol = require( '@stdlib/symbol/match' ); + +function ArrayLike() { + return { + 'length': 3, + '0': 4, + '1': 5, + '2': 6 + }; +} + +function hasInstance( instance ) { + return isArray( instance ); +} + +var x = [ 1, 2, 3 ]; + +defineProperty( ArrayLike, MatchSymbol, { + 'configurable': true, + 'value': null +}); +console.log( instanceOf( x, ArrayLike ) ); + +defineProperty( ArrayLike, MatchSymbol, { + 'configurable': true, + 'value': hasInstance +}); +console.log( instanceOf( x, ArrayLike ) ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/symbol/match/docs/repl.txt b/lib/node_modules/@stdlib/symbol/match/docs/repl.txt new file mode 100644 index 000000000000..608c4674a0a1 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/match/docs/repl.txt @@ -0,0 +1,19 @@ +{{alias}} + Match symbol. + + This symbol specifies the method that retrieves the matches of a string + against a regular expression. + + It is used by methods such as `String.prototype.match()` to customize + matching behavior. + + The symbol is only supported in ES6/ES2015+ environments. For non-supporting + environments, the value is `null`. + + Examples + -------- + > var s = {{alias}} + e.g., + + See Also + -------- diff --git a/lib/node_modules/@stdlib/symbol/match/docs/types/index.d.ts b/lib/node_modules/@stdlib/symbol/match/docs/types/index.d.ts new file mode 100644 index 000000000000..ba6958af5efe --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/match/docs/types/index.d.ts @@ -0,0 +1,31 @@ +/* +* @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. +*/ + +// TypeScript Version: 4.1 + +// EXPORTS // + +/** +* Match symbol. +* +* ## Notes +* +* - This symbol is used to determine whether a constructor object recognizes an object as its instance. +* - The symbol is only supported in ES6/ES2015+ environments. For non-supporting environments, the value is `null`. +*/ +export = Symbol.match; diff --git a/lib/node_modules/@stdlib/symbol/match/docs/types/test.ts b/lib/node_modules/@stdlib/symbol/match/docs/types/test.ts new file mode 100644 index 000000000000..ea3c96d6c7b5 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/match/docs/types/test.ts @@ -0,0 +1,29 @@ +/* +* @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. +*/ + +/* eslint-disable @typescript-eslint/no-unused-expressions */ + +import Match = require( './index' ); + + +// TESTS // + +// The exported value is the `match` symbol... +{ + Match; +} diff --git a/lib/node_modules/@stdlib/symbol/match/examples/index.js b/lib/node_modules/@stdlib/symbol/match/examples/index.js new file mode 100644 index 000000000000..a573b59205ee --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/match/examples/index.js @@ -0,0 +1,51 @@ +/** +* @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'; + +var isArray = require( '@stdlib/assert/is-array' ); +var instanceOf = require( '@stdlib/assert/instance-of' ); +var defineProperty = require( '@stdlib/utils/define-property' ); +var MatchSymbol = require( './../lib' ); + +function ArrayLike() { + return { + 'length': 3, + '0': 4, + '1': 5, + '2': 6 + }; +} + +function Match( instance ) { + return isArray( instance ); +} + +var x = [ 1, 2, 3 ]; + +defineProperty( ArrayLike, MatchSymbol, { + 'configurable': true, + 'value': null +}); +console.log( instanceOf( x, ArrayLike ) ); + +defineProperty( ArrayLike, MatchSymbol, { + 'configurable': true, + 'value': Match +}); +console.log( instanceOf( x, ArrayLike ) ); diff --git a/lib/node_modules/@stdlib/symbol/match/lib/index.js b/lib/node_modules/@stdlib/symbol/match/lib/index.js new file mode 100644 index 000000000000..166e53f744d1 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/match/lib/index.js @@ -0,0 +1,49 @@ +/** +* @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'; + +/** +* Symbol used to determine if a constructor object recognizes an object as its instance. +* +* @module @stdlib/symbol/match +* +* @example +* var isArray = require( '@stdlib/assert/is-array' ); +* var MatchSymbol = require( '@stdlib/symbol/match' ); +* +* function ArrayLike() { +* return { +* 'length': 3, +* '0': 1, +* '1': 2, +* '2': 3 +* }; +* }; +* +* ArrayLike[ MatchSymbol ] = isArray; +*/ + +// MAIN // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/symbol/match/lib/main.js b/lib/node_modules/@stdlib/symbol/match/lib/main.js new file mode 100644 index 000000000000..6852560a0b0c --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/match/lib/main.js @@ -0,0 +1,54 @@ +/** +* @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 matchSymbolSupport = require( '@stdlib/assert/has-has-instance-symbol-support' ); // eslint-disable-line id-length + + +// MAIN // + +/** +* Match symbol. +* +* @name MatchSymbol +* @constant +* @type {(symbol|null)} +* +* @example +* var isArray = require( '@stdlib/assert/is-array' ); +* +* function ArrayLike() { +* return { +* 'length': 3, +* '0': 1, +* '1': 2, +* '2': 3 +* }; +* }; +* +* ArrayLike[ MatchSymbol ] = isArray; +*/ +var MatchSymbol = ( matchSymbolSupport() ) ? Symbol.match : null; // eslint-disable-line max-len + + +// EXPORTS // + +module.exports = MatchSymbol; diff --git a/lib/node_modules/@stdlib/symbol/match/package.json b/lib/node_modules/@stdlib/symbol/match/package.json new file mode 100644 index 000000000000..524aa6953b7c --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/match/package.json @@ -0,0 +1,57 @@ +{ + "name": "@stdlib/symbol/match", + "version": "0.0.0", + "description": "Match symbol.", + "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" + }, + "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", + "symbol", + "sym", + "match" , + "symbol.match" + ] +} diff --git a/lib/node_modules/@stdlib/symbol/match/test/test.js b/lib/node_modules/@stdlib/symbol/match/test/test.js new file mode 100644 index 000000000000..ac21e2f49de1 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/match/test/test.js @@ -0,0 +1,52 @@ +/** +* @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 hasMatchSymbolSupport = require( '@stdlib/assert/has-has-instance-symbol-support' ); // eslint-disable-line id-length +var isSymbol = require( '@stdlib/assert/is-symbol' ); +var Sym = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasMatchSymbolSupport() +}; + + +// TESTS // + +tape( 'main export is a symbol in supporting environments (ES6/2015+) or otherwise null', function test( t ) { + t.ok( true, __filename ); + if ( opts.skip ) { + t.strictEqual( Sym, null, 'main export is null' ); + } else { + t.strictEqual( typeof Sym, 'symbol', 'main export is a symbol' ); + t.strictEqual( isSymbol( Sym ), true, 'main export is a symbol' ); + } + t.end(); +}); + +tape( 'the main export is an alias for `Symbol.match`', opts, function test( t ) { + t.strictEqual( Sym, Symbol.match, 'returns expected value' ); + t.end(); +}); From 2539106ed0d1edbbfab3659e198935731c572dcf Mon Sep 17 00:00:00 2001 From: Saloni Tarone Date: Mon, 10 Nov 2025 19:52:22 +0530 Subject: [PATCH 2/3] chore(example): re-signoff commit --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- From 728317d4a7f3b92f45406d32e6ed806072fedce5 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Wed, 19 Nov 2025 02:09:41 +0000 Subject: [PATCH 3/3] fix: resolve lint errors --- lib/node_modules/@stdlib/symbol/match/lib/main.js | 4 ++-- lib/node_modules/@stdlib/symbol/match/test/test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/symbol/match/lib/main.js b/lib/node_modules/@stdlib/symbol/match/lib/main.js index 6852560a0b0c..c9db4bc8c289 100644 --- a/lib/node_modules/@stdlib/symbol/match/lib/main.js +++ b/lib/node_modules/@stdlib/symbol/match/lib/main.js @@ -20,7 +20,7 @@ // MODULES // -var matchSymbolSupport = require( '@stdlib/assert/has-has-instance-symbol-support' ); // eslint-disable-line id-length +var matchSymbolSupport = require( '@stdlib/assert/has-has-instance-symbol-support' ); // MAIN // @@ -46,7 +46,7 @@ var matchSymbolSupport = require( '@stdlib/assert/has-has-instance-symbol-suppor * * ArrayLike[ MatchSymbol ] = isArray; */ -var MatchSymbol = ( matchSymbolSupport() ) ? Symbol.match : null; // eslint-disable-line max-len +var MatchSymbol = ( matchSymbolSupport() ) ? Symbol.match : null; // EXPORTS // diff --git a/lib/node_modules/@stdlib/symbol/match/test/test.js b/lib/node_modules/@stdlib/symbol/match/test/test.js index ac21e2f49de1..97959f727d63 100644 --- a/lib/node_modules/@stdlib/symbol/match/test/test.js +++ b/lib/node_modules/@stdlib/symbol/match/test/test.js @@ -21,7 +21,7 @@ // MODULES // var tape = require( 'tape' ); -var hasMatchSymbolSupport = require( '@stdlib/assert/has-has-instance-symbol-support' ); // eslint-disable-line id-length +var hasMatchSymbolSupport = require( '@stdlib/assert/has-has-instance-symbol-support' ); var isSymbol = require( '@stdlib/assert/is-symbol' ); var Sym = require( './../lib' );