Skip to content

Commit 39ff009

Browse files
committed
add-symbol/match
1 parent 78441ba commit 39ff009

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

lib/node_modules/@stdlib/symbol/match/docs/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
// EXPORTS //
2222

2323
/**
24-
* Replace symbol.
24+
* Match symbol.
2525
*
2626
* ## Notes
2727
*
28-
* - This symbol provides a method for replacing substrings matched by the current object.
28+
* - This symbol provides a method that matches a regular expression against a string.
2929
* - The symbol is only supported in ES6/ES2015+ environments. For non-supporting environments, the value is `null`.
3030
*/
3131
export = Symbol.match;

lib/node_modules/@stdlib/symbol/match/examples/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,18 @@ var MatchSymbol = require( '@stdlib/symbol/match' );
2323

2424
var regexp = /foo/;
2525

26-
// override the default `Symbol.match` behavior using stdlib's `MatchSymbol`
26+
2727
defineProperty( regexp, MatchSymbol, {
2828
'configurable': true,
2929
'enumerable': false,
3030
'writable': true,
3131
'value': false
3232
});
3333

34-
// Without overriding MatchSymbol, this would normally throw an error in all engines:
35-
// "/foo/".startsWith(regexp);
3634

3735
console.log( "/foo/".startsWith( regexp ) );
3836
// Expected output: true
3937

4038
console.log( "/baz/".endsWith( regexp ) );
39+
// Expected output: false
4140

0 commit comments

Comments
 (0)