| | |
| | | 'use strict'; |
| | | var redefineAll = require('../internals/redefine-all'); |
| | | var uncurryThis = require('../internals/function-uncurry-this'); |
| | | var defineBuiltIns = require('../internals/define-built-ins'); |
| | | var getWeakData = require('../internals/internal-metadata').getWeakData; |
| | | var anObject = require('../internals/an-object'); |
| | | var isObject = require('../internals/is-object'); |
| | |
| | | var internalStateGetterFor = InternalStateModule.getterFor; |
| | | var find = ArrayIterationModule.find; |
| | | var findIndex = ArrayIterationModule.findIndex; |
| | | var splice = uncurryThis([].splice); |
| | | var id = 0; |
| | | |
| | | // fallback for uncaught frozen keys |
| | |
| | | var index = findIndex(this.entries, function (it) { |
| | | return it[0] === key; |
| | | }); |
| | | if (~index) this.entries.splice(index, 1); |
| | | if (~index) splice(this.entries, index, 1); |
| | | return !!~index; |
| | | } |
| | | }; |
| | | |
| | | module.exports = { |
| | | getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { |
| | | var C = wrapper(function (that, iterable) { |
| | | anInstance(that, C, CONSTRUCTOR_NAME); |
| | | var Constructor = wrapper(function (that, iterable) { |
| | | anInstance(that, Prototype); |
| | | setInternalState(that, { |
| | | type: CONSTRUCTOR_NAME, |
| | | id: id++, |
| | |
| | | }); |
| | | if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); |
| | | }); |
| | | |
| | | var Prototype = Constructor.prototype; |
| | | |
| | | var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); |
| | | |
| | |
| | | return that; |
| | | }; |
| | | |
| | | redefineAll(C.prototype, { |
| | | defineBuiltIns(Prototype, { |
| | | // `{ WeakMap, WeakSet }.prototype.delete(key)` methods |
| | | // https://tc39.es/ecma262/#sec-weakmap.prototype.delete |
| | | // https://tc39.es/ecma262/#sec-weakset.prototype.delete |
| | |
| | | } |
| | | }); |
| | | |
| | | redefineAll(C.prototype, IS_MAP ? { |
| | | defineBuiltIns(Prototype, IS_MAP ? { |
| | | // `WeakMap.prototype.get(key)` method |
| | | // https://tc39.es/ecma262/#sec-weakmap.prototype.get |
| | | get: function get(key) { |
| | |
| | | } |
| | | }); |
| | | |
| | | return C; |
| | | return Constructor; |
| | | } |
| | | }; |