summaryrefslogtreecommitdiffstats
path: root/js/src/builtin/RegExp.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/builtin/RegExp.js')
-rw-r--r--js/src/builtin/RegExp.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/js/src/builtin/RegExp.js b/js/src/builtin/RegExp.js
index 91212066c..7218fc0e8 100644
--- a/js/src/builtin/RegExp.js
+++ b/js/src/builtin/RegExp.js
@@ -1166,3 +1166,24 @@ function RegExpStringIteratorNext() {
result.value = match;
return result;
}
+
+// String.prototype.matchAll proposal.
+// ES2020 draft rev e97c95d064750fb949b6778584702dd658cf5624
+// 7.2.8 IsRegExp ( argument )
+function IsRegExp(argument) {
+ // Step 1.
+ if (!IsObject(argument)) {
+ return false;
+ }
+
+ // Step 2.
+ var matcher = argument[std_match];
+
+ // Step 3.
+ if (matcher !== undefined) {
+ return !!matcher;
+ }
+
+ // Steps 4-5.
+ return IsPossiblyWrappedRegExpObject(argument);
+}