Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
591 bytes
|
Line | |
---|
1 | var classof = require('./classof-raw');
|
---|
2 | var regexpExec = require('./regexp-exec');
|
---|
3 |
|
---|
4 | // `RegExpExec` abstract operation
|
---|
5 | // https://tc39.es/ecma262/#sec-regexpexec
|
---|
6 | module.exports = function (R, S) {
|
---|
7 | var exec = R.exec;
|
---|
8 | if (typeof exec === 'function') {
|
---|
9 | var result = exec.call(R, S);
|
---|
10 | if (typeof result !== 'object') {
|
---|
11 | throw TypeError('RegExp exec method returned something other than an Object or null');
|
---|
12 | }
|
---|
13 | return result;
|
---|
14 | }
|
---|
15 |
|
---|
16 | if (classof(R) !== 'RegExp') {
|
---|
17 | throw TypeError('RegExp#exec called on incompatible receiver');
|
---|
18 | }
|
---|
19 |
|
---|
20 | return regexpExec.call(R, S);
|
---|
21 | };
|
---|
22 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.