
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
array-prefer
Advanced tools
Returns a copy of the input array, with preferred items moved to the front.
npm i array-prefer -S
None. Suitable for usage on nodejs or on the browser, via browserify/webpack.
const arrayPrefer = require('array-prefer');
const outArray = arrayPrefer(inArray, hasPriority, limit);
inArray
an input array of items (required)
hasPriority
a function that returns truthy or falsey on items, indicating items that have priority (required)
limit
an integer indicating the maximum number of items that may have priority (optional)
outArray
a copy of inArray
with items having priority moved to the front (lowest indexes).
Except for moving some items to the front of the array, the order of items is otherwise preserved.
arrayPrefer([3,1,2], (x)=>(x<3)) // --> [1,2,3]
arrayPrefer([3,1,2], (x)=>(x<3), 0) // --> [3,1,2]
arrayPrefer([3,1,2], (x)=>(x<3), 1) // --> [1,3,2]
arrayPrefer([3,1,2], (x)=>(x<3), 2) // --> [1,2,3]
Copyright 2019 Paul Brewer, Economic and Financial Technology Consulting LLC
MIT
FAQs
return array sorted by boolean priority function.
The npm package array-prefer receives a total of 1 weekly downloads. As such, array-prefer popularity was classified as not popular.
We found that array-prefer 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
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.