regexp-get-flags.js 487 B

123456789101112
  1. var call = require('../internals/function-call');
  2. var hasOwn = require('../internals/has-own-property');
  3. var isPrototypeOf = require('../internals/object-is-prototype-of');
  4. var regExpFlags = require('../internals/regexp-flags');
  5. var RegExpPrototype = RegExp.prototype;
  6. module.exports = function (R) {
  7. var flags = R.flags;
  8. return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R)
  9. ? call(regExpFlags, R) : flags;
  10. };