MCPcopy
hub / github.com/webpack/webpack / dequeue

Method dequeue

lib/util/ArrayQueue.js:61–72  ·  view source on GitHub ↗

* Removes and returns the next item in FIFO order, switching to a reversed * buffer when that is cheaper than shifting from the front of the array. * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty.

()

Source from the content-addressed store, hash-verified

59 * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty.
60 */
61 dequeue() {
62 if (this._listReversed.length === 0) {
63 if (this._list.length === 0) return;
64 if (this._list.length === 1) return this._list.pop();
65 if (this._list.length < 16) return this._list.shift();
66 const temp = this._listReversed;
67 this._listReversed = this._list;
68 this._listReversed.reverse();
69 this._list = temp;
70 }
71 return this._listReversed.pop();
72 }
73
74 /**
75 * Removes the first matching item from whichever internal buffer currently

Callers 3

processModuleMethod · 0.95
applyMethod · 0.95
[Symbol.iterator]Method · 0.95

Calls 1

popMethod · 0.80

Tested by

no test coverage detected