
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-object-array
Advanced tools
A tiny library to sort array of objects based on multiple properties
A tiny library to sort array of objects based on multiple properties.
Ultra small, just 0.50KB [minified+gzipped] and 2.25KB [uncompressed source].
If you are using npm
$ npm install --save sort-object-array
or include index.js manually as
<script src="index.js" charset="utf-8"></script>
const sort = require('objectarray-sort');
sort([{a:{b:2}},{a:{b:6}},{a:{b:1}}], 'a.b');
sort(test, ['a.b', 'a.c.d', 'a.e.f.g'], ['desc', 'asc', 'desc']);
For browser environments, the library exports a global arraySort, which can be used in a similar fashion,
arraySort(test, ['a.b', 'a.c', 'a.d'], ['desc', 'asc', 'desc']);
// returns the sorted 'test' array
Sorts and returns an array.
Type: Array
Default: none
Array to be sorted
Type: String | Array
Default: none
The property against which sorting is to be performed. A single string value or array of strings.
If an array is passed, the priority of sort is in decreases from left to right.
Say, if you pass ['a.b', 'a.c'] as the argument, the function will sort the array based on 'a.b' first, then for same values of 'a.b', it will sort those values by 'a.c' and so on.
By default, all orders are ascending. For changing order, see order.
Type: String | Array
Default: 'asc'
The order which sorting is to be performed. A single string value or array of strings. Values are 'asc' or 'desc'.
If it is an array, it maps one to one to the arguments of sortBy.
In the example sort(test, ['a.b', 'a.c.d', 'a.e.f.g'], ['desc', 'asc', 'desc']), 'a.b' is sorted in descending order, 'a.c.d' in ascending order and 'a.e.f.g' in descending order.
Defaults to 'asc'.
FAQs
A tiny library to sort array of objects based on multiple properties
The npm package sort-object-array receives a total of 13 weekly downloads. As such, sort-object-array popularity was classified as not popular.
We found that sort-object-array 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.