Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
sorted-array
Advanced tools
An implementation of John von Neumann's sorted arrays in JavaScript. Implements insertion sort and binary search for fast insertion and deletion.
An implementation of John von Neumann's sorted arrays in JavaScript. Implements insertion sort and binary search for fast insertion and deletion.
Sorted arrays may be installed on node.js via the node package manager using the command npm install sorted-array
.
You may also install it on RingoJS using the command ringo-admin install javascript/sorted-array
.
You may install it as a component for web apps using the command component install javascript/sorted-array
.
The six line tutorial on sorted arrays:
var SortedArray = require("sorted-array");
var sorted = new SortedArray([3, 1, 5, 2, 4]);
console.dir(sorted.array); // [1, 2, 3, 4, 5]
sorted.search(3); // 2
sorted.remove(3); // [1, 2, 4, 5]
sorted.insert(3); // [1, 2, 3, 4, 5]
You may pass an optional compare function as a second argument to the SortedArray
constructor.
You may also use the SortedArray.comparing(property, array)
factory function to create a new SortedArray
which compares values by their property
. For example, to compare arrays by length
:
var SortedArray = require("sorted-array");
var sorted = SortedArray.comparing(length, [[3,3,3], [1], [5,5,5,5,5], [2,2], [4,4,4,4]]);
console.dir(sorted.array); // [[1], [2,2], [3,3,3], [4,4,4,4], [5,5,5,5,5]]
function length(a) {
return a.length;
}
FAQs
An implementation of John von Neumann's sorted arrays in JavaScript. Implements insertion sort and binary search for fast insertion and deletion.
The npm package sorted-array receives a total of 9,498 weekly downloads. As such, sorted-array popularity was classified as popular.
We found that sorted-array 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.