Skip to main content

@terascope/utils / queue / Queue

Class: Queue<T>

A basic FIFO queue

Type parameters

Type parameter
T

Constructors

new Queue()

new Queue<T>(): Queue<T>

Returns

Queue<T>

Properties

optional head: default<T>

Source

packages/utils/src/queue/index.ts:5


tail?

optional tail: default<T>

Source

packages/utils/src/queue/index.ts:6

Methods

dequeue()

dequeue(): undefined | T

Returns

undefined | T

Source

packages/utils/src/queue/index.ts:28


each()

each(fn): void

Iterate over each value

Parameters

ParameterType
fn(value) => void

Returns

void

Source

packages/utils/src/queue/index.ts:50


enqueue()

enqueue(value): void

A value to the end of the queue

Parameters

ParameterType
valueT

Returns

void

Source

packages/utils/src/queue/index.ts:10


exists()

exists(key, val): boolean

Search the queue to see if a key value pair exists

Parameters

ParameterType
keystring
valunknown

Returns

boolean

Source

packages/utils/src/queue/index.ts:165


extract()

extract(key, val): undefined | T

Search the queue for a key that matches a value and return the match

Parameters

ParameterType
keystring
valunknown

Returns

undefined | T

Source

packages/utils/src/queue/index.ts:114


remove()

remove(id, keyForID?): void

Parameters

ParameterType
idstring
keyForID?string

Returns

void

Source

packages/utils/src/queue/index.ts:61


size()

size(): number

Get the length of the queue

Returns

number

Source

packages/utils/src/queue/index.ts:158


unshift()

unshift(value): void

Parameters

ParameterType
valueT

Returns

void

Source

packages/utils/src/queue/index.ts:18