
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Sort input array, return sorted ids of the array items, keeping the initial array unchanged.
Useful to perform linked sorting of multiple arrays, where linked array[s] should be sorted the same way as the primary one.
import sortIds from 'sort-ids'
import reorder from 'array-rearrange'
const rates = [.12, .47, .52, .97, ...sourceNumbers]
const names = ['John', 'Alexa', 'Jimmy', 'Kate', ...linkedItems]
const ids = sortIds(rates)
const sortedRates = reorder(rates, ids)
const sortedNames = reorder(names, ids)
ids = sortIds(array, ids?, precise=true)Calculate ids corresponding to sorted input array. The input array isn't changed. Optionally pass input ids - some initial order of ids. precise flag makes sure no missorts took place and resolves them, if any. Disabling that can save ~30ms for 1e6 items input arrays.
See also array-rearrange for reordering input array based on a list of ids.
This package is >= 6 times faster compared to sorting function. That is achieved by packing input value - id pairs into a single float64 value and performing native sort on that Float64Array, then unpacking the ids back.
The idea was proposed by Robert Monfera for snap-points-2d and eventually implemented. But there may be other applications, like sorting colors etc.
(c) 2018 Dmitry Iv. MIT License
FAQs
Calculate sorting identifiers
We found that sort-ids 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.