Skip to content

onesy-me/stack

Repository files navigation



onesy logo

onesy Stack

Stack


MIT license     Production ready     UMD 1.5kb gzipped     100% test cov     Browser and Nodejs

Very simple code     Modern code     Junior friendly     Typescript     Made with 💛


Getting started

Add

yarn add @onesy/stack

Use cases

  • Reversing
  • Undo/redo
  • Backtracking
  • Call stack
  • etc.

Use

  import OnesyStack from '@onesy/stack';

  // Make a new stack instance
  const onesyStack = new OnesyStack();

  // Add values
  onesyStack.push(1, 2, 3, 4);

  onesyStack.first;
  // 4

  onesyStack.length;
  // 4

  const value = onesyStack.pop();

  value;
  // 4

  onesyStack.first;
  // 3

  onesyStack.length;
  // 3

Dev

Install

yarn

Test

yarn test

Prod

Build

yarn build

Releases

No releases published

Packages

No packages published