This package has been deprecated

Author message:

This package is no longer maintained.

@typemon/stack
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Stack

npm-version npm-downloads

push push push peek pop

Usage

$ npm install @typemon/stack
import { Stack } from '@typemon/stack';
const stack: Stack<string> = new Stack(['a']); // ['a'] count = 1

stack.push('b');  // ['a', 'b']      count = 2
stack.push('c');  // ['a', 'b', 'c'] count = 3

stack.peek(); // 'c' ['a', 'b', 'c'] count = 3

stack.pop();  // 'c' ['a', 'b']      count = 2

Get Item

const stack: Stack<string> = new Stack(['a']);

stack.get(0);  // 'a'

stack.get(1);  // error: 'The index is out of range.'
stack.get(-1); // error: 'The index is out of range.'

Package Sidebar

Install

npm i @typemon/stack

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

6.46 kB

Total Files

7

Last publish

Collaborators

  • monsterspace.network