MCPcopy Create free account
hub / github.com/angular/dev-infra / iteratorMixin

Function iteratorMixin

github-actions/saucelabs/set-saucelabs-env.js:4707–4763  ·  view source on GitHub ↗
(name, object, kInternalIterator, keyIndex = 0, valueIndex = 1)

Source from the content-addressed store, hash-verified

4705 configurable: true,
4706 value: `${name} Iterator`
4707 },
4708 next: { writable: true, enumerable: true, configurable: true }
4709 });
4710 return function(target, kind) {
4711 return new FastIterableIterator(target, kind);
4712 };
4713 }
4714 function iteratorMixin(name, object, kInternalIterator, keyIndex = 0, valueIndex = 1) {
4715 const makeIterator = createIterator(name, kInternalIterator, keyIndex, valueIndex);
4716 const properties = {
4717 keys: {
4718 writable: true,
4719 enumerable: true,
4720 configurable: true,
4721 value: function keys() {
4722 webidl.brandCheck(this, object);
4723 return makeIterator(this, "key");
4724 }
4725 },
4726 values: {
4727 writable: true,
4728 enumerable: true,
4729 configurable: true,
4730 value: function values() {
4731 webidl.brandCheck(this, object);
4732 return makeIterator(this, "value");
4733 }
4734 },
4735 entries: {
4736 writable: true,
4737 enumerable: true,
4738 configurable: true,
4739 value: function entries() {
4740 webidl.brandCheck(this, object);
4741 return makeIterator(this, "key+value");
4742 }
4743 },
4744 forEach: {
4745 writable: true,
4746 enumerable: true,
4747 configurable: true,
4748 value: function forEach(callbackfn, thisArg = globalThis) {
4749 webidl.brandCheck(this, object);
4750 webidl.argumentLengthCheck(arguments, 1, `${name}.forEach`);
4751 if (typeof callbackfn !== "function") {
4752 throw new TypeError(
4753 `Failed to execute 'forEach' on '${name}': parameter 1 is not of type 'Function'.`
4754 );
4755 }
4756 for (const { 0: key, 1: value } of makeIterator(this, "key+value")) {
4757 callbackfn.call(thisArg, value, key, this);
4758 }
4759 }
4760 }
4761 };
4762 return Object.defineProperties(object.prototype, __spreadProps(__spreadValues({}, properties), {
4763 [Symbol.iterator]: {
4764 writable: true,

Callers 1

""Function · 0.70

Calls 3

createIteratorFunction · 0.70
__spreadPropsFunction · 0.70
__spreadValuesFunction · 0.70

Tested by

no test coverage detected