JSPM

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

Tiny stack for browser or server

Package Exports

  • tiny-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 (tiny-stack) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Tiny Stack

Stack micro library for the browser or server. When loaded as a script tag on the browser, Tiny Stack be available as 'stack()'.

build status

API

clear

Clears the stack

length

Gets the length/size of the stack

peek

Gets the top item of the stack

pop

Gets & removes the top item of the stack

push

Adds an item to the top the stack

Example

var stack   = require("tiny-stack"),
    mystack = stack();


mystack.length(); // 0
mystack.push({name: "John Doe"});
mystack.push({name: "Jane Doe"});
mystack.length(); // 2
mystack.peek(); // {name: "Jane Doe"}
mystack.pop();
mystack.length(); // 1
mystack.peek(); // {name: "John Doe"}
mystack.clear();
mystack.length(); // 0