(name, object, kInternalIterator, keyIndex = 0, valueIndex = 1)
| 5683 | } |
| 5684 | __name(createIterator, "createIterator"); |
| 5685 | function iteratorMixin(name, object, kInternalIterator, keyIndex = 0, valueIndex = 1) { |
| 5686 | const makeIterator = createIterator(name, kInternalIterator, keyIndex, valueIndex); |
| 5687 | const properties = { |
| 5688 | keys: { |
| 5689 | writable: true, |
| 5690 | enumerable: true, |
| 5691 | configurable: true, |
| 5692 | value: /* @__PURE__ */ __name(function keys() { |
| 5693 | webidl.brandCheck(this, object); |
| 5694 | return makeIterator(this, "key"); |
| 5695 | }, "keys") |
| 5696 | }, |
| 5697 | values: { |
| 5698 | writable: true, |
| 5699 | enumerable: true, |
| 5700 | configurable: true, |
| 5701 | value: /* @__PURE__ */ __name(function values() { |
| 5702 | webidl.brandCheck(this, object); |
| 5703 | return makeIterator(this, "value"); |
| 5704 | }, "values") |
| 5705 | }, |
| 5706 | entries: { |
| 5707 | writable: true, |
| 5708 | enumerable: true, |
| 5709 | configurable: true, |
| 5710 | value: /* @__PURE__ */ __name(function entries() { |
| 5711 | webidl.brandCheck(this, object); |
| 5712 | return makeIterator(this, "key+value"); |
| 5713 | }, "entries") |
| 5714 | }, |
| 5715 | forEach: { |
| 5716 | writable: true, |
| 5717 | enumerable: true, |
| 5718 | configurable: true, |
| 5719 | value: /* @__PURE__ */ __name(function forEach(callbackfn, thisArg = globalThis) { |
| 5720 | webidl.brandCheck(this, object); |
| 5721 | webidl.argumentLengthCheck(arguments, 1, `${name}.forEach`); |
| 5722 | if (typeof callbackfn !== "function") { |
| 5723 | throw new TypeError( |
| 5724 | `Failed to execute 'forEach' on '${name}': parameter 1 is not of type 'Function'.` |
| 5725 | ); |
| 5726 | } |
| 5727 | for (const { 0: key, 1: value } of makeIterator(this, "key+value")) { |
| 5728 | callbackfn.call(thisArg, value, key, this); |
| 5729 | } |
| 5730 | }, "forEach") |
| 5731 | } |
| 5732 | }; |
| 5733 | return Object.defineProperties(object.prototype, { |
| 5734 | ...properties, |
| 5735 | [Symbol.iterator]: { |
| 5736 | writable: true, |
| 5737 | enumerable: false, |
| 5738 | configurable: true, |
| 5739 | value: properties.entries.value |
| 5740 | } |
| 5741 | }); |
| 5742 | } |
no test coverage detected
searching dependent graphs…