blob: e1054813f1493a96f993ba0f830656f9678d3b64 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4
5var $match = GetIntrinsic('%Symbol.match%', true);
6
7var hasRegExpMatcher = require('is-regex');
8
9var ToBoolean = require('./ToBoolean');
10
11// https://ecma-international.org/ecma-262/6.0/#sec-isregexp
12
13module.exports = function IsRegExp(argument) {
14 if (!argument || typeof argument !== 'object') {
15 return false;
16 }
17 if ($match) {
18 var isRegExp = argument[$match];
19 if (typeof isRegExp !== 'undefined') {
20 return ToBoolean(isRegExp);
21 }
22 }
23 return hasRegExpMatcher(argument);
24};