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 utils
$ npm install array-misc
// Import
var arrayMisc = require('array-misc');
arrayMisc.someFuntion();
var arr = [1,2,3,4,5];
arrayMisc.up(arr, 4);
console.log(arr); // -> [1,2,3,5,4]
var arr = [1,2,3,4,5];
arrayMisc.down(arr, 0);
console.log(arr); // -> [2,1,3,4,5]
var arr = [1,2,3,4,5];
arrayMisc.custom(arr, 0, 4)
console.log(arr); // -> [2,3,4,5,1]
var arr = [1,2,3,4,5];
arrayMisc.removeItem(2, arr)
console.log(arr); // -> [1,3,4,5]
var arr = [{id:"1", title:"First"},{id:"2", title:"Second"},{id:"3", title:"Third"}];
var otherArr = [{id:"2", title:"Second"},{id:"3", title:"Third"},{id:"4", title:"Fourth"}];
var result = arrayMisc.getElementsNotFoundInOtherArrayByComparingPropValues(arr, 'id', otherArr, 'id');
console.log(result) // => [{id:"4", title:"Fourth"}]
var arr = [{id:"1", title:"First"},{id:"2", title:"Second"},{id:"3", title:"Third"}];
var otherArr = [{objectId:"2", title:"Second"},{objectId:"3", title:"Third"},{objectId:"4", title:"Fourth"}];
var result = arrayMisc.filterArrayPropValuesByOtherArrayPropValues(arr, 'id', otherArr, 'objectId');
console.log(result) // => [{id:"2", title:"Second"},{id:"3", title:"Third"}]
var arr = [
{type:"orange", title:"First"},
{type:"orange", title:"Second"},
{type:"banana", title:"Third"},
{type:"banana", title:"Fourth"}
];
var gB = groupBy(arr, 'type'); // => {orange:[...], banana:[...]}
gB.orange; // => [{"type":"orange","title":"First"},{"type":"orange","title":"Second"}]
gB.banana; // => [{"type":"banana","title":"Third"},{"type":"banana","title":"Fourth"}]
var arrMisc = require('array-misc');
var array1 = ["arr1", "arr2","common3","arr3", "common1", "common2", "arr4", "arr5", "arr6"];
var array2 = ["arrOther1", "arrOther2","common1", "common2", "common3", "extra"];
arrMisc.findCommonValues(array1,array2);
arrMisc.findNotCommonValues(array1,array2);
arrMisc.findArrValuesNotFoundInOtherArr(array1,array2);
arrMisc.findArrValuesNotFoundInOtherArr(array2,array1);
// Output
// ["common1", "common2", "common3"]
// ["arr1", "arr2", "arr3", "arr4", "arr5", "arr6", "arrOther1", "arrOther2", "extra"]
// ["arr1", "arr2", "arr3", "arr4", "arr5", "arr6"]
// ["arrOther1", "arrOther2", "extra"]
FAQs
Array utils
We found that array-misc 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.