main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
540 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var GetIntrinsic = require('get-intrinsic');
|
---|
| 4 |
|
---|
| 5 | var $match = GetIntrinsic('%Symbol.match%', true);
|
---|
| 6 |
|
---|
| 7 | var hasRegExpMatcher = require('is-regex');
|
---|
| 8 |
|
---|
| 9 | var ToBoolean = require('./ToBoolean');
|
---|
| 10 |
|
---|
| 11 | // https://262.ecma-international.org/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 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.