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.
safe-push-apply
Advanced tools
Push an array of items into an array, while being robust against prototype modification
Push an array of items into an array, while being robust against prototype modification.
npm install --save safe-push-apply
var safePushApply = require('safe-push-apply');
var assert = require('assert');
var arr = [1, 2, 3];
var orig = Array.prototype[Symbol.iterator];
delete Array.prototype[Symbol.iterator];
assert.throws(() => {
try {
arr.push(...[3, 4, 5]);
} finally {
Array.prototype[Symbol.iterator] = orig;
}
}, 'array is not iterable anymore');
delete Array.prototype.push;
safePushApply(arr, [3, 4, 5]);
assert.deepEqual(arr, [1, 2, 3, 3, 4, 5]);
Simply clone the repo, npm install
, and run npm test
FAQs
Push an array of items into an array, while being robust against prototype modification
The npm package safe-push-apply receives a total of 0 weekly downloads. As such, safe-push-apply popularity was classified as not popular.
We found that safe-push-apply demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.