is-regexp.js 436 B

123456789101112
  1. var isObject = require('../internals/is-object');
  2. var classof = require('../internals/classof-raw');
  3. var wellKnownSymbol = require('../internals/well-known-symbol');
  4. var MATCH = wellKnownSymbol('match');
  5. // `IsRegExp` abstract operation
  6. // https://tc39.es/ecma262/#sec-isregexp
  7. module.exports = function (it) {
  8. var isRegExp;
  9. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
  10. };