Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
array-cursor
Advanced tools
Data structure that wraps an array. It allows to slice it without mutate the array itself. It just takes into consideration two indexes (begin and end).
Example:
var a = new ArrayCursor([1, 2, 3, 4]);
var b = a.slice(1, -1);
a.length; // 2
a.get(0); // 1
a.get(1); // 2
a.get(3); // 3
a.get(4); // 4
b.length; // 2
b.get(0); // 2
b.get(1); // 3
a.toArray(); // [1, 2, 3, 4] this creates a new array!
b.toArray(); // [2, 3] this creates a new array!
The API is quite limited but, if you don't need to mutate the array and you only need to see different slices, it is crazy fast! (try running npm run benchmarks).
You create an ArrayCursor with:
var arrayCursor = new ArrayCursor(array, begin, end);
begin and end follow the same rules as Array.prototype.slice.
The length of the array is in the length attribute. Then original array is in data but you can only see from begin to end.
The object has the following methods:
As of node 8.7 proxies are so slow to instantiate that defeat completely the purpose of the library.
FAQs
An immutable array that can sliced without actually mutating
The npm package array-cursor receives a total of 0 weekly downloads. As such, array-cursor popularity was classified as not popular.
We found that array-cursor 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.