Options
All
  • Public
  • Public/Protected
  • All
Menu

Stacks are indexed collections which support very efficient O(1) addition and removal from the front using unshift(v) and shift().

For familiarity, Stack also provides push(v), pop(), and peek(), but be aware that they also operate on the front of the list, unlike List or a JavaScript Array.

Note: reverse() or any inherent reverse traversal (reduceRight, lastIndexOf, etc.) is not efficient with a Stack.

Stack is implemented with a Single-Linked List.

Index

Functions

Functions

  • True if the provided value is a Stack

    Parameters

    • maybeStack: unknown

    Returns maybeStack is <internal>.Stack<unknown>

  • Creates a new Stack containing values.

    Type parameters

    • T

    Parameters

    • Rest ...values: T[]

    Returns <internal>.Stack<T>

Generated using TypeDoc