ixfx
    Preparing search index...

    Creates a stack. Mutable. Use StackImmutable for an immutable alternative.

    // Create
    const s = new StackMutable();
    // Add one or more items
    s.push(1, 2, 3, 4);

    // See what's on top
    s.peek; // 4

    // Remove the top-most, and return it
    s.pop(); // 4

    // Now there's a new top-most element
    s.peek; // 3

    Type Parameters

    • V

    Implements

    Index

    Accessors

    Constructors

    Methods

    Properties

    Accessors

    • get peek(): undefined | V

      Get the item at the top of the stack without removing it (like pop would do)

      Returns undefined | V

      Item at the top of the stack, or undefined if empty.

    Constructors

    Methods

    Properties

    data: readonly V[]
    opts: StackOpts