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

@iamlizu/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

@iamlizu/stack

Stack implementation using Array.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

stack

Javascript implementation of Stack data structure, using Array.

Getting Started


Install in your project with,

npm install @iamlizu/stack

Usage example,

const Stack = require("@iamlizu/stack")

// Create new instance
const stack1 = new Stack();

stack1.push(10);
console.log(stack1.getBuffer()) // [ 10 ]

Available Methods


MethodDescription
getBufferreturns a shallow copy of the Stack array
isEmptyreturn true if empty
pushadds item to the Stack
popremove item from the Stack
peekreturns the top item from Stack without popping it
sizereturns the length of the Stack
clearresets the Stack to empty
access(index)returns the item on index from Stack
search(item)returns the index of given item in the Stack

Contributing


You are very much appreciated to add new functionalities to this module. Please add all the required test cases for the functionality.

You may create a pull request and wait to get reviewed, merged.

🚀 Happy coding!

Keywords

FAQs

Package last updated on 29 Sep 2021

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