
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A small library for sorting arrays by multiple criteria.
npm install multisort --save
bower install multisort --save
var input = [
{firstName: "Kate", lastName: "Bush"},
{firstName: "George", lastName: "Bush", suffix: "Junior"},
{firstName: "George", lastName: "Orwell"},
{firstName: "George", lastName: "Bush", suffix: "Senior"},
];
var criteria = [
'firstName',
'~lastName.length',
'suffix.charAt(1)'
];
multisort(inputArray, criteria)
// input is now sorted by firstName (ascending), then lastName.length (descending),
// and finally suffix.charAt, called with 1 as the argument:
// [
// {firstName: "George", lastName: "Orwell"},
// {firstName: "George", lastName: "Bush", suffix: "Senior"},
// {firstName: "George", lastName: "Bush", suffix: "Junior"},
// {firstName: "Kate", lastName: "Bush"},
// ];
var input = [8, 7, 6, 5, 4, 3, 2, 1];
var criteria = [
function(a) {return a % 2},
function(a) {return a % 3},
function(a) {return a}
];
multisort(input, criteria);
// input is now:
// [6, 4, 2, 8, 3, 1, 7, 5]
// Passing a single argument makes a sorting function that can then be applied to lists.
var sortByMod2AndMod3 = multisort([
function(a) {return a % 2},
function(a) {return a % 3},
function(a) {return a}
]);
var input1 = [8, 7, 6, 5, 4, 3, 2, 1];
sortByMod2AndMod3(input1);
// input1 is [6, 4, 2, 8, 3, 1, 7, 5]
var input2 = [1, 5, 10, 25, 50, 100];
sortByMod2AndMod3(input2);
// input2 is [10, 100, 50, 1, 25, 5]
Criteria types:
npm test
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
FAQs
Sort an array using any number of separate, ranked criteria
The npm package multisort receives a total of 3,568 weekly downloads. As such, multisort popularity was classified as popular.
We found that multisort 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.