
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
Store values based on their priorities.
Install the module via NPM: npm i priorities.
After that you must require this module in any file you'd want to use it in.
const List = require("priorities");
// List is the class. Make an instance of it!
const myList = new List();
The PriorityList is a multi dimensional array based on the value's priorities! Every value has an index and a subIndex. The index starts from 1 while the subIndex starts from 0. The code below is a simple priority list structure.
{
1: ["First", "Second", "Third"],
2: "Forth"
}
First's index is 1 and subIndex is 0, making it the value with the highest priority. Forth's index is 2 and subIndex is 0, making it the value with the lowest priority.
The PriorityList class has a lot of useful features on working with priorities. See the documentation for more info.
It just stores values in a unique way - it does not save them in a file and then load them up. All data in the priority lists will be lost once the node process is killed.
Adding a value:
myList.add(1, "First") // We added the value 'First' to the first index of the list.
myList.add(1, "Second")
myList.add(2, "Third")
myList.add(2, "Forth")
myList.add(3, "Fifth")
myList.add(4, "Sixth")
Removing a value:
myList.remove("First") // We remove 'First' from the list.
Getting values:
myList.getByVal("Second") // {value: "Second", index: 1, subIndex: 0}
myList.getByPos(1) // {value: "Second", index: 1, subIndex: 0} since there is only 1 value in index 1.
myList.add(1, "RealSecond")
myList.getByPos(1, 1) // {value: "RealSecond", index: 1, subIndex: 1}
myList.find((val, index, subIndex) => val == "Fifth") // {value: "Fifth", index: 1, subIndex: 1}
Working with priorities:
myList.compare("Second", "RealSecond") // Returns: "higher". Because "Second"'s subIndex is smaller than "RealSecond"'s subIndex, so "Second" is a higher priority.
myList.highestOf("Sixth", "Forth", "Second") // Returns: "Second".
myList.lowestOf("Fifth", "Third", "RealSecond") // Returns: "Fifth"
myList.highest // Returns: Second
myList.lowest // Returns: Sixth
Run the tests by doing npm run test
Click here to see the documentation.
FAQs
Store variables and data based on their priority.
We found that priorities 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.