1 var classof = require('./classof-raw');
2 var regexpExec = require('./regexp-exec');
4 // `RegExpExec` abstract operation
5 // https://tc39.es/ecma262/#sec-regexpexec
6 module.exports = function (R, S) {
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');
16 if (classof(R) !== 'RegExp') {
17 throw TypeError('RegExp#exec called on incompatible receiver');
20 return regexpExec.call(R, S);