BoundedStack
Defined in: packages/data/src/stack/bounded-stack.ts:21
A LIFO stack that holds at most capacity items and throws once full.
Type Parameters
Section titled “Type Parameters”T extends DefinedValue
The type of elements in the stack.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BoundedStack<
T>(iterable,options):BoundedStack<T>
Defined in: packages/data/src/stack/bounded-stack.ts:27
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T, any, any> | undefined
options
Section titled “options”Returns
Section titled “Returns”BoundedStack<T>
Properties
Section titled “Properties”capacity
Section titled “capacity”
readonlycapacity:number
Defined in: packages/data/src/stack/bounded-stack.ts:25
The maximum number of elements the collection can hold.
Note: Infinity is not a legal value here — an unbounded type omits this
mixin.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<T>
Defined in: packages/data/src/stack/bounded-stack.ts:37
Returns
Section titled “Returns”Iterator<T>
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
void
Defined in: packages/data/src/stack/bounded-stack.ts:41
Removes all elements from the collection.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”count()
Section titled “count()”count():
number
Defined in: packages/data/src/stack/bounded-stack.ts:45
The number of elements in the collection.
A method, not a getter: its async counterpart needs a round trip to the backing store, and a member must have the same shape in both.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”pop():
T|undefined
Defined in: packages/data/src/stack/bounded-stack.ts:76
Removes and returns the item at the top of the stack.
Returns
Section titled “Returns”T | undefined
The item at the top of the stack, or undefined if the stack is
empty.
Implementation of
Section titled “Implementation of”push()
Section titled “push()”push(
item):void
Defined in: packages/data/src/stack/bounded-stack.ts:56
Same as IStack.push, but throws once the stack is full.
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”void
Throws
Section titled “Throws”If the operation would exceed the stack’s capacity.
IStack.push
Implementation of
Section titled “Implementation of”pushAll()
Section titled “pushAll()”pushAll(
items):void
Defined in: packages/data/src/stack/bounded-stack.ts:70
Same as IStack.pushAll, but throws once the stack is full. Nothing is
added when it throws — the check is made against the whole batch.
Parameters
Section titled “Parameters”readonly T[]
Returns
Section titled “Returns”void
Throws
Section titled “Throws”If the operation would exceed the stack’s capacity.
IStack.pushAll
Implementation of
Section titled “Implementation of”top():
T|undefined
Defined in: packages/data/src/stack/bounded-stack.ts:80
Returns the item at the top of the stack without removing it.
Returns
Section titled “Returns”T | undefined
The item at the top of the stack, or undefined if the stack is
empty.