diff options
Diffstat (limited to 'js/vendor/es6-shim/es6-shim.js')
-rw-r--r-- | js/vendor/es6-shim/es6-shim.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/js/vendor/es6-shim/es6-shim.js b/js/vendor/es6-shim/es6-shim.js index 1e80a9ff4..6a537728f 100644 --- a/js/vendor/es6-shim/es6-shim.js +++ b/js/vendor/es6-shim/es6-shim.js @@ -1250,6 +1250,10 @@ if (!regExpSupportsFlagsWithRegex && supportsDescriptors) { var OrigRegExp = RegExp; var RegExpShim = function RegExp(pattern, flags) { + var calledWithNew = this instanceof RegExp; + if (!calledWithNew && (Type.regex(pattern) || pattern.constructor === RegExp)) { + return pattern; + } if (Type.regex(pattern) && Type.string(flags)) { return new RegExp(pattern.source, flags); } |