
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
complex-sort
Advanced tools
Simplify the creation of complex/compound sorts on JavaScript arrays
This module creates a sort function which is a compilation of the supplied sorting functions. In this way it accomplishes complex sorting with one or more sort criteria. It can also make complex sort logic more readable by breaking sort logic into discrete pieces.
var complexSort = require("complex-sort"),
arrayToSort = [
{ p1: 1, p2: "b", id: "Peter"},
{ p1: 1, p2: "a", id: "Bjorn"}
];
arrayToSort.sort(complexSort({
sortingFunctions: [
function (a, b) { return a.p1 > b.p1 ? 1 : a.p1 < b.p1 ? -1 : 0; },
function (a, b) { return a.p2 > b.p2 ? 1 : a.p2 < b.p2 ? -1 : 0; }
],
invert: false//Just including this to document that you can reverse your sort
});
//arrayToSort now has Bjorn first (at 0) and Peter second
Question and comments are appreciated!
FAQs
0.0.1
The npm package complex-sort receives a total of 0 weekly downloads. As such, complex-sort popularity was classified as not popular.
We found that complex-sort 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
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.