diff options
Diffstat (limited to 'node_modules/core-js/internals/add-to-unscopables.js')
| -rw-r--r-- | node_modules/core-js/internals/add-to-unscopables.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/node_modules/core-js/internals/add-to-unscopables.js b/node_modules/core-js/internals/add-to-unscopables.js new file mode 100644 index 0000000..4af733d --- /dev/null +++ b/node_modules/core-js/internals/add-to-unscopables.js @@ -0,0 +1,20 @@ +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.github.io/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; +}; |
