source: trip-planner-front/node_modules/core-js/modules/es.regexp.to-string.js@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1'use strict';
2var redefine = require('../internals/redefine');
3var anObject = require('../internals/an-object');
4var $toString = require('../internals/to-string');
5var fails = require('../internals/fails');
6var flags = require('../internals/regexp-flags');
7
8var TO_STRING = 'toString';
9var RegExpPrototype = RegExp.prototype;
10var nativeToString = RegExpPrototype[TO_STRING];
11
12var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
13// FF44- RegExp#toString has a wrong name
14var INCORRECT_NAME = nativeToString.name != TO_STRING;
15
16// `RegExp.prototype.toString` method
17// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
18if (NOT_GENERIC || INCORRECT_NAME) {
19 redefine(RegExp.prototype, TO_STRING, function toString() {
20 var R = anObject(this);
21 var p = $toString(R.source);
22 var rf = R.flags;
23 var f = $toString(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
24 return '/' + p + '/' + f;
25 }, { unsafe: true });
26}
Note: See TracBrowser for help on using the repository browser.