es.regexp.flags.js 547 B

12345678910111213
  1. var DESCRIPTORS = require('../internals/descriptors');
  2. var objectDefinePropertyModule = require('../internals/object-define-property');
  3. var regExpFlags = require('../internals/regexp-flags');
  4. var UNSUPPORTED_Y = require('../internals/regexp-sticky-helpers').UNSUPPORTED_Y;
  5. // `RegExp.prototype.flags` getter
  6. // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
  7. if (DESCRIPTORS && (/./g.flags != 'g' || UNSUPPORTED_Y)) {
  8. objectDefinePropertyModule.f(RegExp.prototype, 'flags', {
  9. configurable: true,
  10. get: regExpFlags
  11. });
  12. }