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

2.0.6 • Public • Published

@zerodep/struct-stack

version language types license

CodeFactor Known Vulnerabilities

A factory function that returns an optionally-typed Stack data structure instance

Full documentation is available at the zerodep.app page.

Examples

All @zerodep packages support both ESM and CJS.

import { structStackFactory } from '@zerodep/struct-stack';
// or
const { structStackFactory } = require('@zerodep/struct-stack');

Use Case

const stack = structStackFactory(['a', 'b']);

// add items to the stack
stack.push('c');
stack.push('d');

// size()
stack.size(); // 4

// pop()
stack.pop(); // "d"

// peek()
stack.peek(); // "c"

// toArray()
stack.toArray(); // ["a", "b", "c"]

Package Sidebar

Install

npm i @zerodep/struct-stack

Homepage

zerodep.app

Weekly Downloads

2

Version

2.0.6

License

MIT

Unpacked Size

4.67 kB

Total Files

7

Last publish

Collaborators

  • cdepage