FuncType - v0.8.85
    Preparing search index...

    Type Alias Stack<A>

    Stack: {
        ap<B extends unknown>(ff: Stack<(value: A) => B>): Stack<B>;
        flatMap<B extends unknown>(f: (a: A) => Stack<B>): Stack<B>;
        flatMapAsync<B extends unknown>(
            f: (value: A) => PromiseLike<Stack<B>>,
        ): PromiseLike<Stack<B>>;
        map<B extends unknown>(f: (a: A) => B): Stack<B>;
        match<R>(patterns: { Empty: () => R; NonEmpty: (values: A[]) => R }): R;
        peek(): Option<A>;
        pop(): [Stack<A>, Option<A>];
        push(value: A): Stack<A>;
        toArray(): A[];
        toList(): List<A>;
        toString(): string;
    } & Traversable<A> & Valuable<"Stack", A[]> & Serializable<A> & Pipe<A[]> & Foldable<
        A,
    > & Matchable<A[], "Empty" | "NonEmpty">

    Stack data structure - Last In, First Out (LIFO) Implements the Traversable interface for working with ordered collections

    Type Parameters

    Type declaration

    • ap: function
      • Applies a Stack of functions to this Stack

        Type Parameters

        • B extends unknown

        Parameters

        • ff: Stack<(value: A) => B>

          Stack of functions to apply

        Returns Stack<B>

        A new Stack with applied functions

    • flatMap: function
      • Maps each element to a Stack and flattens the result

        Type Parameters

        • B extends unknown

        Parameters

        • f: (a: A) => Stack<B>

          The mapping function returning a Stack

        Returns Stack<B>

        A new flattened Stack

    • flatMapAsync: function
      • Maps each element to an async Stack and flattens the result

        Type Parameters

        • B extends unknown

        Parameters

        • f: (value: A) => PromiseLike<Stack<B>>

          The async mapping function returning a Stack

        Returns PromiseLike<Stack<B>>

        A promise of the new flattened Stack

    • map: function
      • Transforms each element in the stack using the provided function

        Type Parameters

        • B extends unknown

        Parameters

        • f: (a: A) => B

          The mapping function

        Returns Stack<B>

        A new Stack with transformed elements

    • match: function
      • Pattern matches over the Stack, applying a handler function based on whether it's empty

        Type Parameters

        • R

        Parameters

        • patterns: { Empty: () => R; NonEmpty: (values: A[]) => R }

          Object with handler functions for Empty and NonEmpty variants

        Returns R

        The result of applying the matching handler function

    • peek: function
      • Return the top value without removing it

        Returns Option<A>

        The top value wrapped in an Option

    • pop: function
      • Remove and return the top value from the stack

        Returns [Stack<A>, Option<A>]

        A tuple containing the new Stack and the value

    • push: function
      • Push a value onto the top of the stack

        Parameters

        • value: A

          The value to push

        Returns Stack<A>

        A new Stack with the value added

    • toArray: function
      • Convert the stack to an array

        Returns A[]

        An array of all elements

    • toList: function
      • Convert the stack to a List

        Returns List<A>

        A List containing all elements

    • toString: function
      • Returns a string representation of the stack

        Returns string

        A string representation