JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4519
  • Score
    100M100P100Q126824F
  • License MIT

stack implementation in javascript

Package Exports

  • @datastructures-js/stack

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@datastructures-js/stack) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stack

build:? npm npm npm

elements data type: any type.

Usage

const stackFn = require('@datastructures-js/stack');
const stack = stackFn();

API

.push(element)

push an element to the top of the stack.

stack.push('test');

.peek()

returns the top element in the stack.

console.log(stack.peek()); // test

.pop()

pops the top element of the stack.

console.log(stack.pop()); // test
console.log(stack.peek()); // null

.isEmpty()

checks if the stack is empty.

console.log(stack.isEmpty()); // true

.length()

returns the length length of the stack.

console.log(stack.length()); // 0

Build

grunt build

License

The MIT License. Full License is here