
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@bletchley-tech/stack
Advanced tools
Stack.js provides a simple, fast, and flexible implementation of the stack data structure built natively in JavaScript.
$ npm install @bletchley-tech/stack
Stack provides a simple implementation of the stack data structure built natively in JavaScript for use in Node.js.
The package provides a single class, Stack, which is a simple implementation of the stack data structure. To use it, follow the steps below:
Import/Require the Stack class:
// CommonJS
const Stack = require('@bletchley-tech/stack');
// ES6+
import Stack from '@bletchley-tech/stack';
This will load the Stack class into the global scope.
Create a new instance of Stack:
const stack = new Stack();
This will create a new instance of Stack and store it in the stack variable.
Use the stack:
stack.push(1); // Push 1 to top of the stack
stack.stack; // "a"
stack.pop(); // Pop the top item from the stack
This will push 1 to the top of the stack, print the updated stack, and then pop the top item from the stack.
The Stack class has only one property, stack, which is an array of values. The specific functionality of the stack data structure is provided through class methods.
The push method adds a value to the top of the stack.
stack.push("string"); // Push "string" to top of the stack
The pushMany method will push all of the values to the top of the stack.
stack.pushMany("string2", "string3"); // Push "string2" and "string3" to top of the stack
// or
stack.pushMany(["string2", "string3"]); // Push "string2" and "string3" to top of the stack
The pop method will pop the top item from the stack.
stack.pop(); // Pop the top item from the stack
The clear method will clear the stack.
stack.clear(); // Clear the stack
stack.size; // Get the size of the stack
This will return the size of the stack.
stack.isEmpty; // Check if the stack is empty
This will return true if the stack is empty, false otherwise.
stack.top; // Get the top item from the stack
This will return the top item from the stack.
stack.stack; // Print the stack as a formatted string
This will return the stack as a formatted string.
Stack is licensed under the MIT License (see the LICENSE file for more information).
FAQs
A native JavaScript implementation of the Stack data structure
We found that @bletchley-tech/stack 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.