a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Shared / Stack
A generic stack implementation with a maximum capacity.
• T
The type of elements in the stack.
IStack
<T
>new Stack<
T
>(maxCapacity
):Stack
<T
>
• maxCapacity: number
Stack
<T
>
isEmpty():
boolean
Checks if the collection is empty.
boolean
True if the collection has no elements, otherwise false.
isFull():
boolean
Determines whether the container or collection has reached its maximum capacity. Checks if the number of elements in the collection is equal to its predefined maximum capacity.
boolean
True if the number of elements equals the maximum capacity, otherwise false.
peek():
T
Returns the top element of the stack without removing it. Throws an error if the stack is empty.
T
The top element of the stack.
If the stack is empty.
pop():
T
Removes the top element from the stack and returns it. If the stack is empty, an error is thrown.
T
The top element of the stack if available, otherwise undefined.
StackUnderflowError if the stack is empty.
push(
item
):void
Adds an item to the top of the stack.
• item: T
The item to be added to the stack.
void
No return value.
If the stack is already at its maximum capacity.
size():
number
Retrieves the size of the collection.
number
The number of elements in the collection.