Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fathym_common/src/common/iterables/Stack.ts

The Fathym Reference Architecture provides the common foundation for applications built in Typescript.
Latest
import * as fathymCommon from "https://deno.land/x/fathym_common@v0.2.173/src/common/iterables/Stack.ts";

This is a simple implementation of a stack data structure.

Examples

From direct import

import { Stack } from "@fathym/common/iterables";

const stack = new Stack<number>();

stack.Push(1);

stack.Push(2);

stack.Pop(); // Output: 2

stack.Peek(); // Output: 1

stack.Pop(); // Output: 1

stack.IsEmpty(); // Output: true

From common import

import { Stack } from "@fathym/common";

const stack = new Stack<number>();

stack.Push(1);

stack.Push(2);

stack.Pop(); // Output: 2

stack.Pop(); // Output: 1

Classes

This is a simple implementation of a stack data structure.