Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tiny-stack

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-stack

Tiny stack for browser or server

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Tiny Stack

Stack for Client or Server.

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

empty

Tests if this stack is empty

Returns the 1-based position where an object is on this stack

Example

const stack = require("tiny-stack"),
    mystack = stack(),
    jane = {name: "Jane Doe"},
    john = {name: "John Doe"};

mystack.length(); // 0
mystack.empty(); // true
mystack.push(john);
mystack.push(jane);
mystack.length(); // 2
mystack.search(jane); // 1
mystack.search(john); // 2
mystack.search({}); // -1
mystack.empty(); // false
mystack.peek(); // {name: "Jane Doe"}
mystack.pop();
mystack.length(); // 1
mystack.peek(); // {name: "John Doe"}
mystack.clear();
mystack.length(); // 0

Keywords

FAQs

Package last updated on 13 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc