You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
666 B
21 lines
666 B
3 years ago
|
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||
|
var create = require('../internals/object-create');
|
||
|
var definePropertyModule = require('../internals/object-define-property');
|
||
|
|
||
|
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
||
|
var ArrayPrototype = Array.prototype;
|
||
|
|
||
|
// Array.prototype[@@unscopables]
|
||
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
||
|
if (ArrayPrototype[UNSCOPABLES] == undefined) {
|
||
|
definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
|
||
|
configurable: true,
|
||
|
value: create(null)
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// add a key to Array.prototype[@@unscopables]
|
||
|
module.exports = function (key) {
|
||
|
ArrayPrototype[UNSCOPABLES][key] = true;
|
||
|
};
|