1
|
'use strict';
|
2
|
|
3
|
var GetIntrinsic = require('../GetIntrinsic');
|
4
|
|
5
|
var $match = GetIntrinsic('%Symbol.match%', true);
|
6
|
|
7
|
var hasRegExpMatcher = require('is-regex');
|
8
|
|
9
|
var ToBoolean = require('./ToBoolean');
|
10
|
|
11
|
// https://ecma-international.org/ecma-262/6.0/#sec-isregexp
|
12
|
|
13
|
module.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
|
};
|