mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-23 22:33:17 +00:00
22 lines
831 B
JavaScript
22 lines
831 B
JavaScript
|
var DESCRIPTORS = require('../internals/descriptors');
|
||
|
var UNSUPPORTED_Y = require('../internals/regexp-sticky-helpers').UNSUPPORTED_Y;
|
||
|
var defineProperty = require('../internals/object-define-property').f;
|
||
|
var getInternalState = require('../internals/internal-state').get;
|
||
|
var RegExpPrototype = RegExp.prototype;
|
||
|
|
||
|
// `RegExp.prototype.sticky` getter
|
||
|
if (DESCRIPTORS && UNSUPPORTED_Y) {
|
||
|
defineProperty(RegExp.prototype, 'sticky', {
|
||
|
configurable: true,
|
||
|
get: function () {
|
||
|
if (this === RegExpPrototype) return undefined;
|
||
|
// We can't use InternalStateModule.getterFor because
|
||
|
// we don't add metadata for regexps created by a literal.
|
||
|
if (this instanceof RegExp) {
|
||
|
return !!getInternalState(this).sticky;
|
||
|
}
|
||
|
throw TypeError('Incompatible receiver, RegExp required');
|
||
|
}
|
||
|
});
|
||
|
}
|