File tree Expand file tree Collapse file tree
lib/node_modules/@stdlib/symbol/match Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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*/
3131export = Symbol . match ;
Original file line number Diff line number Diff line change @@ -23,19 +23,18 @@ var MatchSymbol = require( '@stdlib/symbol/match' );
2323
2424var regexp = / f o o / ;
2525
26- // override the default `Symbol.match` behavior using stdlib's `MatchSymbol`
26+
2727defineProperty ( 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
3735console . log ( "/foo/" . startsWith ( regexp ) ) ;
3836// Expected output: true
3937
4038console . log ( "/baz/" . endsWith ( regexp ) ) ;
39+ // Expected output: false
4140
You can’t perform that action at this time.
0 commit comments