Socket
Socket
Sign inDemoInstall

stack-ds

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    stack-ds

A simple stack data structure.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
12.9 kB
Created
Weekly downloads
 

Readme

Source

stack-ds

A simple stack data structure.

Installation

	npm install stack-ds -save

API

  • Stack() - Constructor var mystack = new Stack();

  • Stack.isStack(obj) - Check if obj is Stack. Returns boolean. Stack.isStack(myobject);

  • .push(obj) - Push an obj into the stuck. Returns this. mystack.push({a:5});

  • .pop() - Pop the top object from the stack. Returns the poped object mystack.pop();

  • .peek() - Get the top object. var top = mystack.peek();

  • .size() - Get the size of the stack. var size = mystack.size();

  • .isEmpty() - Check if the stack is empty. Returns boolean. mystack.isEmpty();

  • .setMaxSize(max_size) - Set the maximum size of the stack. Returns this. mystack.setMaxtSize(10);

  • .getMaxSize() - Get the maximum size of the stack. mystack.getMaxtSize();

  • .empty() - Empty the stack. Returns this. mystack.empty();

  • .isFull() - Check if the stack is full. Returns boolean. mystack.isEmpty();

  • .copy(other) - Copies other into this. Returns this. mystack.copy(otherstack);

  • .compare(other) - Compares other and this stacks. Returns boolean. mystack.compare(otherstack;

  • .toString(debug) - Export a string representation of the stack. If debug is set to true will export a full representation for each element mystack.toString();

  • .toArray() - Exports an array with stacks's data. mystack.toArray();

TEST

In order to test the library run :

	npm test

You need to have mocha installed

	npm install -g mocha

LICENSE

MIT

Copyright (c) 2016 Skevos Papamichail <contact@skevosp.me> (www.skevosp.me)

Keywords

FAQs

Last updated on 24 Sep 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc