Skip to content

IStack

Defined in: packages/data/src/stack/istack.ts:14

Interface representing a stack data type

A stack is a collection that follows the Last In First Out (LIFO) principle, where the last item added to the stack is the first one to be removed.

T extends DefinedValue = DefinedValue

The type of elements in the stack. Anything except undefined, which means “no element”.

[iterator](): Iterator<T, any, any>

Defined in: node_modules/.store/typescript-npm-6.0.3-585eecd158/package/lib/lib.es2015.iterable.d.ts:47

Iterator<T, any, any>

ICollection.[iterator]


clear(): void

Defined in: packages/data/src/collection/icollection.ts:23

Removes all elements from the collection.

void

ICollection.clear


count(): number

Defined in: packages/data/src/collection/icollection.ts:20

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.

number

ICollection.count


pop(): T | undefined

Defined in: packages/data/src/stack/istack.ts:38

Removes and returns the item at the top of the stack.

T | undefined

The item at the top of the stack, or undefined if the stack is empty.


push(item): void

Defined in: packages/data/src/stack/istack.ts:22

Adds an item to the top of the stack.

T

The item to add to the stack.

void


pushAll(items): void

Defined in: packages/data/src/stack/istack.ts:30

Adds every item to the top of the stack, in array order, so the last one is the first to be popped.

readonly T[]

The items to add to the stack.

void


top(): T | undefined

Defined in: packages/data/src/stack/istack.ts:46

Returns the item at the top of the stack without removing it.

T | undefined

The item at the top of the stack, or undefined if the stack is empty.