New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

just-a-stack

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-a-stack

just a stack implementation

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

just-a-stack

A linked list implementation of a stack.


###Objects###

Stack
The stack object returned when require is called on this library

var Stack = require('just-a-stack');
var stack = new Stack();

###Methods###

push(data)
Pushes data onto the top of the stack

var text = "i like to do drawings";
stack.push(text);
console.log(stack.peek());
//> i like to do drawings

pop()
Pops data off the top of the stack

var intro = "hello my name";
stack.push(intro);
var name = "is simon";
stack.push(name);
console.log(stack.pop());
//> is simon

peek()
Returns the data on the top of the stack without modifying the stack

var intro = "hello my name";
stack.push(intro);
var name = "is simon";
stack.push(name);
console.log(stack.peek());
//> is simon
console.log(stack.pop());
//> is simon

size()
Returns the size of the stack

console.log(stack.size());
//> 2

isEmpty()
Convience method that checks if the stack size is 0

if (!stack.isEmpty()) {
	while(stack.pop());
}
console.log(stack.isEmpty());
//> true

Keywords

FAQs

Package last updated on 04 Nov 2012

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