|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
700 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 | var call = require('../internals/function-call');
|
|---|
| 3 | var anObject = require('../internals/an-object');
|
|---|
| 4 | var isCallable = require('../internals/is-callable');
|
|---|
| 5 | var classof = require('../internals/classof-raw');
|
|---|
| 6 | var regexpExec = require('../internals/regexp-exec');
|
|---|
| 7 |
|
|---|
| 8 | var $TypeError = TypeError;
|
|---|
| 9 |
|
|---|
| 10 | // `RegExpExec` abstract operation
|
|---|
| 11 | // https://tc39.es/ecma262/#sec-regexpexec
|
|---|
| 12 | module.exports = function (R, S) {
|
|---|
| 13 | var exec = R.exec;
|
|---|
| 14 | if (isCallable(exec)) {
|
|---|
| 15 | var result = call(exec, R, S);
|
|---|
| 16 | if (result !== null) anObject(result);
|
|---|
| 17 | return result;
|
|---|
| 18 | }
|
|---|
| 19 | if (classof(R) === 'RegExp') return call(regexpExec, R, S);
|
|---|
| 20 | throw new $TypeError('RegExp#exec called on incompatible receiver');
|
|---|
| 21 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.