.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / es.regexp.sticky.js
1 var DESCRIPTORS = require('../internals/descriptors');
2 var UNSUPPORTED_Y = require('../internals/regexp-sticky-helpers').UNSUPPORTED_Y;
3 var defineProperty = require('../internals/object-define-property').f;
4 var getInternalState = require('../internals/internal-state').get;
5 var RegExpPrototype = RegExp.prototype;
6
7 // `RegExp.prototype.sticky` getter
8 // https://tc39.es/ecma262/#sec-get-regexp.prototype.sticky
9 if (DESCRIPTORS && UNSUPPORTED_Y) {
10   defineProperty(RegExp.prototype, 'sticky', {
11     configurable: true,
12     get: function () {
13       if (this === RegExpPrototype) return undefined;
14       // We can't use InternalStateModule.getterFor because
15       // we don't add metadata for regexps created by a literal.
16       if (this instanceof RegExp) {
17         return !!getInternalState(this).sticky;
18       }
19       throw TypeError('Incompatible receiver, RegExp required');
20     }
21   });
22 }