WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
node_modules/webpack/lib/util/ArrayQueue.js
@@ -6,10 +6,13 @@
"use strict";
/**
 * FIFO queue backed by arrays with a reversed dequeue buffer to avoid the cost
 * of repeated `Array#shift` operations.
 * @template T
 */
class ArrayQueue {
   /**
    * Seeds the queue with an optional iterable of items in dequeue order.
    * @param {Iterable<T>=} items The initial elements.
    */
   constructor(items) {
@@ -26,7 +29,7 @@
   }
   /**
    * Returns the number of elements in this queue.
    * Returns the current number of items waiting in either internal buffer.
    * @returns {number} The number of elements in this queue.
    */
   get length() {
@@ -34,7 +37,7 @@
   }
   /**
    * Empties the queue.
    * Removes all pending items from both internal buffers.
    */
   clear() {
      this._list.length = 0;
@@ -42,7 +45,7 @@
   }
   /**
    * Appends the specified element to this queue.
    * Appends an item to the tail of the queue.
    * @param {T} item The element to add.
    * @returns {void}
    */
@@ -51,7 +54,8 @@
   }
   /**
    * Retrieves and removes the head of this queue.
    * 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.
    */
   dequeue() {
@@ -68,7 +72,8 @@
   }
   /**
    * Finds and removes an item
    * Removes the first matching item from whichever internal buffer currently
    * contains it.
    * @param {T} item the item
    * @returns {void}
    */