
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Stack ADT for browser and nodejs
The Stack class represents a last-in-first-out (LIFO) stack of generic items. It supports the usual push and pop operations, along with methods for peeking at the top item, testing if the stack is empty, and iterating through the items in LIFO order.
All stack operations except iteration and empty are constant time.
Download the production version or the development version.
$ npm install --save stack-adt
$ bower install --save stack-adt
var Stack = require('stack-adt');
var stack = new Stack();
stack.push(10);
stack.peek();
stack.isEmpty();
stack.push("foo");
stack.push({hello: "world"});
stack.peek().hello; // Outputs "world"
stack.push(function(){ console.log("hello") });
stack.peek()(); // Outputs "world"
stack.size();
stack.pop();
stack.size();
var itr = stack.iterator
while(itr.hasNext()) {
console.log(itr.next());
}
stack.empty();
<script type="text/javascript" src="https://raw.githubusercontent.com/pasangsherpa/stack-adt/master/dist/stack-adt.min.js"></script>
<script type="text/javascript">
var stack = new Stack();
stack.push(10);
stack.peek();
stack.isEmpty();
stack.push("foo");
stack.push({hello: "world"});
stack.peek().hello; // Outputs "world"
stack.push(function(){ console.log("hello") });
stack.peek()(); // Outputs "world"
stack.size();
stack.pop();
stack.size();
var itr = stack.iterator
while(itr.hasNext()) {
console.log(itr.next());
}
stack.empty();
</script>
Creates an empty stack with infinite capacity.
Creates an empty stack using the specified capacity.
Type: int
initialCapacity represents the specified capacity.
throws "Stack is full" errorAdds one element to the top of the stack and returns the new size of the stack.
Type: object
the element to be pushed onto stack.
throws "Stack is empty" errorRemoves and returns the top element from the stack.
Type: object
the element removed from the top of the stack.
throws "Stack is empty" errorReturns without removing the top element of the stack.
Type: object
the element on top of the stack.
Returns true if this stack contains no elements.
Type: boolean
whether or not the stack is empty.
Returns the number of elements in the stack.
Type: int
the number of element in the stack.
Removes all element from the the queue and returns the new size of the queue.
Returns an iterator to the stack that iterates through the items in LIFO order.
Type: object
the iterator object of the stack
throws "No such element" errorReturns the next item in LIFO order.
Returns whether the stack has next item in LIFO order.
FAQs
Stack ADT for browser and nodejs
We found that stack-adt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.