MCPcopy Index your code
hub / github.com/immutable-js/immutable-js / pushAll

Method pushAll

src/Stack.js:71–97  ·  view source on GitHub ↗
(iter)

Source from the content-addressed store, hash-verified

69 }
70
71 pushAll(iter) {
72 iter = IndexedCollection(iter);
73 if (iter.size === 0) {
74 return this;
75 }
76 if (this.size === 0 && isStack(iter)) {
77 return iter;
78 }
79 assertNotInfinite(iter.size);
80 let newSize = this.size;
81 let head = this._head;
82 iter.__iterate((value) => {
83 newSize++;
84 head = {
85 value: value,
86 next: head,
87 };
88 }, /* reverse */ true);
89 if (this.__ownerID) {
90 this.size = newSize;
91 this._head = head;
92 this.__hash = undefined;
93 this.__altered = true;
94 return this;
95 }
96 return makeStack(newSize, head);
97 }
98
99 pop() {
100 return this.slice(1);

Callers

nothing calls this directly

Calls 5

IndexedCollectionClass · 0.90
isStackFunction · 0.90
assertNotInfiniteFunction · 0.85
makeStackFunction · 0.85
__iterateMethod · 0.45

Tested by

no test coverage detected