From 0e54564cd8e065e61ca08f8e7cb53f6e346dd8de Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Fri, 9 Jan 2026 14:32:26 +0000 Subject: [PATCH 01/11] feat: add Symbol.search package with docs, examples, tests --- .../@stdlib/symbol/search/README.md | 141 ++++++++++++++++++ .../@stdlib/symbol/search/docs/repl.txt | 18 +++ .../symbol/search/docs/types/index.d.ts | 31 ++++ .../@stdlib/symbol/search/docs/types/test.ts | 30 ++++ .../@stdlib/symbol/search/examples/index.js | 47 ++++++ .../@stdlib/symbol/search/lib/index.js | 49 ++++++ .../@stdlib/symbol/search/lib/main.js | 54 +++++++ .../@stdlib/symbol/search/package.json | 57 +++++++ .../@stdlib/symbol/search/test/test.js | 52 +++++++ 9 files changed, 479 insertions(+) create mode 100644 lib/node_modules/@stdlib/symbol/search/README.md create mode 100644 lib/node_modules/@stdlib/symbol/search/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/symbol/search/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/symbol/search/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/symbol/search/examples/index.js create mode 100644 lib/node_modules/@stdlib/symbol/search/lib/index.js create mode 100644 lib/node_modules/@stdlib/symbol/search/lib/main.js create mode 100644 lib/node_modules/@stdlib/symbol/search/package.json create mode 100644 lib/node_modules/@stdlib/symbol/search/test/test.js diff --git a/lib/node_modules/@stdlib/symbol/search/README.md b/lib/node_modules/@stdlib/symbol/search/README.md new file mode 100644 index 000000000000..73d50d5e7925 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/search/README.md @@ -0,0 +1,141 @@ + + +# SearchSymbol + +> `Symbol.search` which is used to define the search behavior of objects when used with `String.prototype.search`. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var SearchSymbol = require( '@stdlib/symbol/search' ); +``` + +#### searchSymbol + +`Symbol.search` which is used to define the search behavior of objects when used with `String.prototype.search`. + +```javascript +var s = typeof SearchSymbol; +// 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`. + +- `Symbol.search` defines the behavior of an object when used by `String.prototype.search()`. + For example, when `str.search(obj)` is called, JavaScript will check for a `[Symbol.search]` method on `obj` and call it. + +
+ + + + + +
+ +## Examples + + + +```javascript +var isArray = require( '@stdlib/assert/is-array' ); +var instanceOf = require( '@stdlib/assert/instance-of' ); +var defineProperty = require( '@stdlib/utils/define-property' ); +var SearchSymbol = require( '@stdlib/symbol/search' ); + +function ArrayLike() { + return { + 'length': 3, + '0': 4, + '1': 5, + '2': 6 + }; +} + +function hasInstance( instance ) { + return isArray( instance ); +} + +var x = [ 1, 2, 3 ]; + +defineProperty( ArrayLike, SearchSymbol, { + 'configurable': true, + 'value': null +}); +console.log( instanceOf( x, ArrayLike ) ); + +defineProperty( ArrayLike, SearchSymbol, { + 'configurable': true, + 'value': hasInstance +}); +console.log( instanceOf( x, ArrayLike ) ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/symbol/search/docs/repl.txt b/lib/node_modules/@stdlib/symbol/search/docs/repl.txt new file mode 100644 index 000000000000..c7171d0dc40d --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/search/docs/repl.txt @@ -0,0 +1,18 @@ + +{{alias}} + Has instance symbol. + + 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`. + + Examples + -------- + > var s = {{alias}} + e.g., + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/symbol/search/docs/types/index.d.ts b/lib/node_modules/@stdlib/symbol/search/docs/types/index.d.ts new file mode 100644 index 000000000000..185e1ef395e2 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/search/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 // + +/** +* Search symbol. +* +* ## Notes +* +* - This symbol is used by `String.prototype.search()` to find the index of a match in a string. +* - The symbol is only supported in ES6/ES2015+ environments. For non-supporting environments, the value is `null`. +*/ +export = Symbol.search; diff --git a/lib/node_modules/@stdlib/symbol/search/docs/types/test.ts b/lib/node_modules/@stdlib/symbol/search/docs/types/test.ts new file mode 100644 index 000000000000..047e3ad53724 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/search/docs/types/test.ts @@ -0,0 +1,30 @@ +/* +* @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 SearchSymbol = require( './index' ); + + +// TESTS // + +// The exported value is the `search` symbol... +{ + SearchSymbol; +} diff --git a/lib/node_modules/@stdlib/symbol/search/examples/index.js b/lib/node_modules/@stdlib/symbol/search/examples/index.js new file mode 100644 index 000000000000..46f2e0c0fbee --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/search/examples/index.js @@ -0,0 +1,47 @@ +/** +* @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 SearchSymbol = require( './../lib' ); + +function MySearchable() {} +defineProperty(MySearchable.prototype, SearchSymbol, { + 'value': function(str) { + return str.indexOf('foo'); // returns index of 'foo' or -1 + }, + 'configurable': true +}); + +function customSearch(str) { + return str.indexOf('foo'); // example +} + +var str = 'foo bar'; + +var myObj = { + [SearchSymbol](str) { + return str.indexOf('foo'); + } +}; + +console.log('foo bar'.search(myObj)); // 0 +console.log('bar baz'.search(myObj)); // -1 diff --git a/lib/node_modules/@stdlib/symbol/search/lib/index.js b/lib/node_modules/@stdlib/symbol/search/lib/index.js new file mode 100644 index 000000000000..adb92f56e021 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/search/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/search +* +* @example +* var isArray = require( '@stdlib/assert/is-array' ); +* var SearchSymbol = require( '@stdlib/symbol/search' ); +* +* function ArrayLike() { +* return { +* 'length': 3, +* '0': 1, +* '1': 2, +* '2': 3 +* }; +* } +* +* ArrayLike[ SearchSymbol ] = isArray; +*/ + +// MAIN // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/symbol/search/lib/main.js b/lib/node_modules/@stdlib/symbol/search/lib/main.js new file mode 100644 index 000000000000..a336affc40f3 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/search/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 hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' ); // eslint-disable-line id-length + + +// MAIN // + +/** +* Search symbol. +* +* @name SearchSymbol +* @constant +* @type {(symbol|null)} +* +* @example +* var isArray = require( '@stdlib/assert/is-array' ); +* +* function ArrayLike() { +* return { +* 'length': 3, +* '0': 1, +* '1': 2, +* '2': 3 +* }; +* }; +* +* ArrayLike[ SearchSymbol ] = isArray; +*/ +var SearchSymbol = ( hasSearchSymbolSupport() ) ? Symbol.Search : null; // eslint-disable-line max-len + + +// EXPORTS // + +module.exports = SearchSymbol; diff --git a/lib/node_modules/@stdlib/symbol/search/package.json b/lib/node_modules/@stdlib/symbol/search/package.json new file mode 100644 index 000000000000..2ddd435a534c --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/search/package.json @@ -0,0 +1,57 @@ +{ + "name": "@stdlib/symbol/search", + "version": "0.0.0", + "description": "Search 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", + "search" + + ] +} diff --git a/lib/node_modules/@stdlib/symbol/search/test/test.js b/lib/node_modules/@stdlib/symbol/search/test/test.js new file mode 100644 index 000000000000..ec8972e5a634 --- /dev/null +++ b/lib/node_modules/@stdlib/symbol/search/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 hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' ); // eslint-disable-line id-length +var isSymbol = require( '@stdlib/assert/is-symbol' ); +var Sym = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasSearchSymbolSupport() +}; + + +// 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.search`', opts, function test( t ) { + t.strictEqual( Sym, Symbol.search, 'returns expected value' ); + t.end(); +}); From e362fd23200ccc377d09f1e868c373fd840fc53d Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sat, 10 Jan 2026 05:50:29 +0000 Subject: [PATCH 02/11] fix: update Symbol.search package after lint and formatting --- .../@stdlib/symbol/search/README.md | 44 ++++++------------- .../symbol/search/docs/types/index.d.ts | 2 +- .../@stdlib/symbol/search/docs/types/test.ts | 2 +- .../@stdlib/symbol/search/examples/index.js | 29 +++--------- .../@stdlib/symbol/search/lib/index.js | 2 +- .../@stdlib/symbol/search/lib/main.js | 4 +- .../@stdlib/symbol/search/test/test.js | 2 +- 7 files changed, 25 insertions(+), 60 deletions(-) diff --git a/lib/node_modules/@stdlib/symbol/search/README.md b/lib/node_modules/@stdlib/symbol/search/README.md index 73d50d5e7925..830d75b9b425 100644 --- a/lib/node_modules/@stdlib/symbol/search/README.md +++ b/lib/node_modules/@stdlib/symbol/search/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2025 The Stdlib Authors. +Copyright (c) 2026 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. @@ -61,7 +61,7 @@ var s = typeof SearchSymbol; - The [symbol][mdn-symbol] is only supported in environments which support [symbols][mdn-symbol]. In non-supporting environments, the value is `null`. -- `Symbol.search` defines the behavior of an object when used by `String.prototype.search()`. +- `Symbol.search` defines the behavior of an object when used by `String.prototype.search()`. For example, when `str.search(obj)` is called, JavaScript will check for a `[Symbol.search]` method on `obj` and call it. @@ -77,37 +77,19 @@ var s = typeof SearchSymbol; ```javascript -var isArray = require( '@stdlib/assert/is-array' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var defineProperty = require( '@stdlib/utils/define-property' ); var SearchSymbol = require( '@stdlib/symbol/search' ); -function ArrayLike() { - return { - 'length': 3, - '0': 4, - '1': 5, - '2': 6 - }; -} - -function hasInstance( instance ) { - return isArray( instance ); -} - -var x = [ 1, 2, 3 ]; - -defineProperty( ArrayLike, SearchSymbol, { - 'configurable': true, - 'value': null -}); -console.log( instanceOf( x, ArrayLike ) ); - -defineProperty( ArrayLike, SearchSymbol, { - 'configurable': true, - 'value': hasInstance -}); -console.log( instanceOf( x, ArrayLike ) ); +var mySearcher = { + [ SearchSymbol ]: function ( str ) { + return str.indexOf( 'foo' ); + } +}; + +console.log( 'foo bar'.search( mySearcher ) ); +// => 0 + +console.log( 'bar baz'.search( mySearcher ) ); +// => -1 ``` diff --git a/lib/node_modules/@stdlib/symbol/search/docs/types/index.d.ts b/lib/node_modules/@stdlib/symbol/search/docs/types/index.d.ts index 185e1ef395e2..97ba9f685b88 100644 --- a/lib/node_modules/@stdlib/symbol/search/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/symbol/search/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/symbol/search/docs/types/test.ts b/lib/node_modules/@stdlib/symbol/search/docs/types/test.ts index 047e3ad53724..c54dd3bb002f 100644 --- a/lib/node_modules/@stdlib/symbol/search/docs/types/test.ts +++ b/lib/node_modules/@stdlib/symbol/search/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/symbol/search/examples/index.js b/lib/node_modules/@stdlib/symbol/search/examples/index.js index 46f2e0c0fbee..f8027abd01f5 100644 --- a/lib/node_modules/@stdlib/symbol/search/examples/index.js +++ b/lib/node_modules/@stdlib/symbol/search/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. @@ -18,30 +18,13 @@ 'use strict'; -var isArray = require( '@stdlib/assert/is-array' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var defineProperty = require( '@stdlib/utils/define-property' ); var SearchSymbol = require( './../lib' ); -function MySearchable() {} -defineProperty(MySearchable.prototype, SearchSymbol, { - 'value': function(str) { - return str.indexOf('foo'); // returns index of 'foo' or -1 - }, - 'configurable': true -}); - -function customSearch(str) { - return str.indexOf('foo'); // example -} - -var str = 'foo bar'; - -var myObj = { - [SearchSymbol](str) { - return str.indexOf('foo'); +var mySearcher = { + [ SearchSymbol ]: function ( str ) { + return str.indexOf( 'foo' ); } }; -console.log('foo bar'.search(myObj)); // 0 -console.log('bar baz'.search(myObj)); // -1 +console.log( 'foo bar'.search( mySearcher ) ); +console.log( 'bar baz'.search( mySearcher ) ); diff --git a/lib/node_modules/@stdlib/symbol/search/lib/index.js b/lib/node_modules/@stdlib/symbol/search/lib/index.js index adb92f56e021..3b949f6d3f92 100644 --- a/lib/node_modules/@stdlib/symbol/search/lib/index.js +++ b/lib/node_modules/@stdlib/symbol/search/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/symbol/search/lib/main.js b/lib/node_modules/@stdlib/symbol/search/lib/main.js index a336affc40f3..23718ab86426 100644 --- a/lib/node_modules/@stdlib/symbol/search/lib/main.js +++ b/lib/node_modules/@stdlib/symbol/search/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. @@ -46,7 +46,7 @@ var hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' * * ArrayLike[ SearchSymbol ] = isArray; */ -var SearchSymbol = ( hasSearchSymbolSupport() ) ? Symbol.Search : null; // eslint-disable-line max-len +var SearchSymbol = ( hasSearchSymbolSupport() ) ? Symbol.search : null; // eslint-disable-line max-len // EXPORTS // diff --git a/lib/node_modules/@stdlib/symbol/search/test/test.js b/lib/node_modules/@stdlib/symbol/search/test/test.js index ec8972e5a634..0239eab0d936 100644 --- a/lib/node_modules/@stdlib/symbol/search/test/test.js +++ b/lib/node_modules/@stdlib/symbol/search/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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 9f76a29f450069d02975c12f0decd728bac7848d Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sat, 10 Jan 2026 06:08:25 +0000 Subject: [PATCH 03/11] update symbol.search --- lib/node_modules/@stdlib/symbol/search/README.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/symbol/search/README.md b/lib/node_modules/@stdlib/symbol/search/README.md index 830d75b9b425..0cbf4624a97c 100644 --- a/lib/node_modules/@stdlib/symbol/search/README.md +++ b/lib/node_modules/@stdlib/symbol/search/README.md @@ -79,17 +79,14 @@ var s = typeof SearchSymbol; ```javascript var SearchSymbol = require( '@stdlib/symbol/search' ); -var mySearcher = { - [ SearchSymbol ]: function ( str ) { - return str.indexOf( 'foo' ); +var myObj = { + [SearchSymbol]: function customSearch(str) { + return str.indexOf('foo'); // returns index of 'foo' or -1 } }; -console.log( 'foo bar'.search( mySearcher ) ); -// => 0 - -console.log( 'bar baz'.search( mySearcher ) ); -// => -1 +console.log('foo bar'.search(myObj)); // 0 +console.log('bar baz'.search(myObj)); // -1 ``` From 652b3389ea204ab702150a76a17116ccea9d5656 Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sat, 10 Jan 2026 06:15:37 +0000 Subject: [PATCH 04/11] fix: update README.md --- lib/node_modules/@stdlib/symbol/search/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/symbol/search/README.md b/lib/node_modules/@stdlib/symbol/search/README.md index 0cbf4624a97c..47c35c379e9f 100644 --- a/lib/node_modules/@stdlib/symbol/search/README.md +++ b/lib/node_modules/@stdlib/symbol/search/README.md @@ -79,10 +79,9 @@ var s = typeof SearchSymbol; ```javascript var SearchSymbol = require( '@stdlib/symbol/search' ); -var myObj = { - [SearchSymbol]: function customSearch(str) { - return str.indexOf('foo'); // returns index of 'foo' or -1 - } +var myObj = {}; +myObj[SearchSymbol] = function(str) { + return str.indexOf('foo'); }; console.log('foo bar'.search(myObj)); // 0 From ffbad789492ecc0e3a1c803749c9e13cdd75a9c0 Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sat, 10 Jan 2026 06:19:43 +0000 Subject: [PATCH 05/11] fix: update README.md --- lib/node_modules/@stdlib/symbol/search/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/symbol/search/README.md b/lib/node_modules/@stdlib/symbol/search/README.md index 47c35c379e9f..23b7f60bee92 100644 --- a/lib/node_modules/@stdlib/symbol/search/README.md +++ b/lib/node_modules/@stdlib/symbol/search/README.md @@ -79,8 +79,7 @@ var s = typeof SearchSymbol; ```javascript var SearchSymbol = require( '@stdlib/symbol/search' ); -var myObj = {}; -myObj[SearchSymbol] = function(str) { +myObj[SearchSymbol] = (str) => { return str.indexOf('foo'); }; From cf4cba0dd6e4aa7f9c2c8d73b1cf97cb60f083f2 Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sat, 10 Jan 2026 06:23:33 +0000 Subject: [PATCH 06/11] fix: update README.md --- lib/node_modules/@stdlib/symbol/search/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/symbol/search/README.md b/lib/node_modules/@stdlib/symbol/search/README.md index 23b7f60bee92..3f97e6abdf69 100644 --- a/lib/node_modules/@stdlib/symbol/search/README.md +++ b/lib/node_modules/@stdlib/symbol/search/README.md @@ -79,7 +79,8 @@ var s = typeof SearchSymbol; ```javascript var SearchSymbol = require( '@stdlib/symbol/search' ); -myObj[SearchSymbol] = (str) => { +var myObj = {}; +myObj[ SearchSymbol ] = function searchFn(str) { return str.indexOf('foo'); }; From 096c27c238d600dc86ff1224921d0058ef1147f3 Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sat, 10 Jan 2026 06:27:28 +0000 Subject: [PATCH 07/11] fix: update README.md --- lib/node_modules/@stdlib/symbol/search/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/symbol/search/README.md b/lib/node_modules/@stdlib/symbol/search/README.md index 3f97e6abdf69..983fc86307b8 100644 --- a/lib/node_modules/@stdlib/symbol/search/README.md +++ b/lib/node_modules/@stdlib/symbol/search/README.md @@ -79,10 +79,12 @@ var s = typeof SearchSymbol; ```javascript var SearchSymbol = require( '@stdlib/symbol/search' ); -var myObj = {}; -myObj[ SearchSymbol ] = function searchFn(str) { +function searchFn(str) { return str.indexOf('foo'); -}; +} + +var myObj = {}; +myObj[ SearchSymbol ] = searchFn; console.log('foo bar'.search(myObj)); // 0 console.log('bar baz'.search(myObj)); // -1 From 61776d22520acbd566bbf8a9582444da0ded0ce0 Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sat, 10 Jan 2026 12:55:01 +0000 Subject: [PATCH 08/11] fix:whitespaces --- lib/node_modules/@stdlib/symbol/search/lib/main.js | 4 ++-- lib/node_modules/@stdlib/symbol/search/package.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/symbol/search/lib/main.js b/lib/node_modules/@stdlib/symbol/search/lib/main.js index 23718ab86426..2f1407830f37 100644 --- a/lib/node_modules/@stdlib/symbol/search/lib/main.js +++ b/lib/node_modules/@stdlib/symbol/search/lib/main.js @@ -20,7 +20,7 @@ // MODULES // -var hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' ); // eslint-disable-line id-length +var hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' ); // MAIN // @@ -46,7 +46,7 @@ var hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' * * ArrayLike[ SearchSymbol ] = isArray; */ -var SearchSymbol = ( hasSearchSymbolSupport() ) ? Symbol.search : null; // eslint-disable-line max-len +var SearchSymbol = ( hasSearchSymbolSupport() ) ? Symbol.search : null; // EXPORTS // diff --git a/lib/node_modules/@stdlib/symbol/search/package.json b/lib/node_modules/@stdlib/symbol/search/package.json index 2ddd435a534c..27a474fbcc8a 100644 --- a/lib/node_modules/@stdlib/symbol/search/package.json +++ b/lib/node_modules/@stdlib/symbol/search/package.json @@ -52,6 +52,5 @@ "symbol", "sym", "search" - ] } From ed561c61d964354e34248dce4d020193ee162a60 Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sat, 10 Jan 2026 13:26:15 +0000 Subject: [PATCH 09/11] fix:trailing spaces --- lib/node_modules/@stdlib/symbol/search/examples/index.js | 6 +++--- lib/node_modules/@stdlib/symbol/search/lib/main.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/symbol/search/examples/index.js b/lib/node_modules/@stdlib/symbol/search/examples/index.js index f8027abd01f5..1719ca81202d 100644 --- a/lib/node_modules/@stdlib/symbol/search/examples/index.js +++ b/lib/node_modules/@stdlib/symbol/search/examples/index.js @@ -21,9 +21,9 @@ var SearchSymbol = require( './../lib' ); var mySearcher = { - [ SearchSymbol ]: function ( str ) { - return str.indexOf( 'foo' ); - } + [ SearchSymbol ]: function ( str ) { + return str.indexOf( 'foo' ); + } }; console.log( 'foo bar'.search( mySearcher ) ); diff --git a/lib/node_modules/@stdlib/symbol/search/lib/main.js b/lib/node_modules/@stdlib/symbol/search/lib/main.js index 2f1407830f37..9be7a866ba49 100644 --- a/lib/node_modules/@stdlib/symbol/search/lib/main.js +++ b/lib/node_modules/@stdlib/symbol/search/lib/main.js @@ -20,7 +20,7 @@ // MODULES // -var hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' ); +var hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' ); // MAIN // @@ -46,7 +46,7 @@ var hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' * * ArrayLike[ SearchSymbol ] = isArray; */ -var SearchSymbol = ( hasSearchSymbolSupport() ) ? Symbol.search : null; +var SearchSymbol = ( hasSearchSymbolSupport() ) ? Symbol.search : null; // EXPORTS // From a45b1e353aae6413f3bddace0a2541018b27dda8 Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sat, 24 Jan 2026 09:19:27 +0000 Subject: [PATCH 10/11] feat: fix error in examples --- .../@stdlib/symbol/search/examples/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/symbol/search/examples/index.js b/lib/node_modules/@stdlib/symbol/search/examples/index.js index 1719ca81202d..242ae41c3814 100644 --- a/lib/node_modules/@stdlib/symbol/search/examples/index.js +++ b/lib/node_modules/@stdlib/symbol/search/examples/index.js @@ -20,11 +20,12 @@ var SearchSymbol = require( './../lib' ); -var mySearcher = { - [ SearchSymbol ]: function ( str ) { - return str.indexOf( 'foo' ); - } -}; +function searchFn(str) { + return str.indexOf('foo'); +} -console.log( 'foo bar'.search( mySearcher ) ); -console.log( 'bar baz'.search( mySearcher ) ); +var myObj = {}; +myObj[ SearchSymbol ] = searchFn; + +console.log('foo bar'.search(myObj)); // 0 +console.log('bar baz'.search(myObj)); // -1 From 72a98544bc3bd4daa6e87f64bb7cf8d3e373567a Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sat, 24 Jan 2026 09:33:07 +0000 Subject: [PATCH 11/11] feat: fix error --- lib/node_modules/@stdlib/symbol/search/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/symbol/search/test/test.js b/lib/node_modules/@stdlib/symbol/search/test/test.js index 0239eab0d936..2767908e2864 100644 --- a/lib/node_modules/@stdlib/symbol/search/test/test.js +++ b/lib/node_modules/@stdlib/symbol/search/test/test.js @@ -21,7 +21,7 @@ // MODULES // var tape = require( 'tape' ); -var hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' ); // eslint-disable-line id-length +var hasSearchSymbolSupport = require( '@stdlib/assert/has-search-symbol-support' ); var isSymbol = require( '@stdlib/assert/is-symbol' ); var Sym = require( './../lib' );