- Source:
- Implements:
- Iterator
Members
length
- Source:
Number of items in the queue
Methods
dequeue() → {T|undefined}
- Source:
Removes the item at the start of the queue and returns it
Returns:
The removed item or undefined
if empty
- Type
- T | undefined
enqueue(item, priorityopt) → {number}
- Source:
Adds an item to the queue with the given priority. If no priority is given a default of 0
is used
Parameters:
Name | Type | Default | Description |
---|---|---|---|
item |
T | The item to be added to the queue |
|
priority opt |
number |
0
|
The priority for this item. The higher the number the higher the priority |
Returns:
New queue length
- Type
- number
remove(item) → {boolean}
- Source:
Removes the given item from the queue
Parameters:
Name | Type | Description |
---|---|---|
item |
T | Item to remove from queue |
Returns:
true
if item was found and removed, else false
- Type
- boolean