We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5a0931c commit 5f18261Copy full SHA for 5f18261
src/xregexp.js
@@ -980,7 +980,9 @@ XRegExp.isInstalled = (feature) => !!(features[feature]);
980
* XRegExp.isRegExp(RegExp('^', 'm')); // -> true
981
* XRegExp.isRegExp(XRegExp('(?s).')); // -> true
982
*/
983
-XRegExp.isRegExp = (value) => isType(value, 'RegExp');
+XRegExp.isRegExp = (value) => Object.prototype.toString.call(value) === '[object RegExp]';
984
+// Same as `isType(value, 'RegExp')`, but avoiding that function call here for perf since
985
+// `isRegExp` is used heavily by internals including regex construction
986
987
/**
988
* Returns the first matched string, or in global mode, an array containing all matched strings.
0 commit comments