Gathering detailed insights and metrics for sort-es
Gathering detailed insights and metrics for sort-es
Gathering detailed insights and metrics for sort-es
Gathering detailed insights and metrics for sort-es
array.prototype.tosorted
An ESnext spec-compliant `Array.prototype.toSorted` shim/polyfill/replacement that works as far down as ES3.
@jay-es/eslint-plugin-vue-sort-components
A plugin for ESLint to keep order of component names
only-sort
A powerful and flexible TypeScript library for sorting arrays and collections. The library supports sorting of various data types, including strings, numbers, booleans, dates, objects, and arrays.
array.prototype.tospliced
An ESnext spec-compliant `Array.prototype.toSpliced` shim/polyfill/replacement that works as far down as ES3.
Blazing fast, tree-shakeable, type-safe, modern utility library to sort any type of array
npm install sort-es
Typescript
Module System
98.4
Supply Chain
100
Quality
80
Maintenance
100
Vulnerability
100
License
TypeScript (96.66%)
JavaScript (3.21%)
Shell (0.13%)
Total Downloads
500,074
Last Day
3,263
Last Week
29,234
Last Month
98,927
Last Year
359,693
MIT License
46 Stars
286 Commits
5 Forks
5 Watchers
4 Branches
1 Contributors
Updated on Apr 10, 2025
Minified
Minified + Gzipped
Latest Version
1.7.15
Package Id
sort-es@1.7.15
Unpacked Size
60.37 kB
Size
14.18 kB
File Count
42
Published on
Apr 10, 2025
Cumulative downloads
Total Downloads
Last Day
50.6%
3,263
Compared to previous day
Last Week
-11.4%
29,234
Compared to previous week
Last Month
2.4%
98,927
Compared to previous month
Last Year
286.5%
359,693
Compared to previous year
34
The library is available as a npm package. To install the package, run:
npm install sort-es
# or
yarn add sort-es
Start using:
1import {byString} from 'sort-es' 2 3const unsorted = ["xxx", "bbbb", "zzz", "cccc", "aaa"]; 4const sorted = unsorted.sort(byString()); 5 6console.log(sorted); //(5) ["aaa", "bbbb", "cccc", "xxx", "zzz"]
Use directly in the browser
1 2<script src='https://cdn.jsdelivr.net/npm/sort-es/dist/index.umd.js'></script> 3<script> 4 const unsorted = ["xxx", "bbbb", "zzz", "cccc", "aaa"]; 5 const sorted = unsorted.sort(sort.byString()); 6 7 console.log(sorted); //(5) ["aaa", "bbbb", "cccc", "xxx", "zzz"] 8</script> 9 10//or via browser modules 11 12<script type='module'> 13 import {byString} from 'https://cdn.jsdelivr.net/npm/sort-es/dist/index.mjs' 14 15 const unsorted = ["xxx", "bbbb", "zzz", "cccc", "aaa"]; 16 const sorted = unsorted.sort(byString()); 17 18 console.log(sorted); //(5) ["aaa", "bbbb", "cccc", "xxx", "zzz"] 19</script>
sort by a single property
1//js or ts file 2import {byValue, byNumber, byString} from 'sort-es' 3 4const arrayUnsorted = [ 5 {prop: "xxx", foo: 34}, 6 {prop: "aaa", foo: 325}, 7 {prop: "zzz", foo: 15}, 8 {prop: "ccc", foo: 340}, 9 {prop: "bbb", foo: 0} 10]; 11 12//this sort by the foo property ascending 13const sortedByFoo = arrayUnsorted.sort(byValue((i) => i.foo, byNumber())); 14console.log(sortedByFoo); //(5) [{prop: "bbb", foo : 0}, {prop: "zzz", foo: 15}, .....]; 15 16//this sort by the prop property descending 17const sortedByProp = arrayUnsorted.sort(byValue((i) => i.prop, byString({desc: true}))); 18console.log(sortedByProp); //(5) [{prop: "zzz", foo : 15}, {prop: "xxx", foo: 34}, .....];
sort by a multiple property
1//js or ts file 2import {byNumber, byString, byValues} from "sort-es"; 3 4const objsToSort = [ 5 {id: 2, name: 'teresa'}, 6 {id: 3, name: 'roberto'}, 7 {id: 2, name: 'roberto'} 8]; 9 10//i sort by THEIR NAMES and THEN by their ids 11const sortedObject = objsToSort.sort(byValues([ 12 [(x) => x.name, byString()], 13 [(x) => x.id, byNumber()] 14])); 15 16console.log(sortedObject); //[{roberto, 2}, {roberto, 3}, {teresa, 2}]; 17 18//i sort by THEIR IDS and THEN by their names 19const sortedObject2 = objsToSort.sort(byValues([ 20 [(x) => x.id, byNumber()], 21 [(x) => x.name, byString()] 22])); 23console.log(sortedObject2); //[{roberto, 2}, {teresa, 2}, {roberto, 3}]; 24 25//i sort by THEIR IDS and THEN by their names DESCENDING 26const sortedObject3 = objsToSort.sort(byValues([ 27 [(x) => x.id, byNumber()], 28 [(x) => x.name, byString({desc: true})], 29])); 30console.log(sortedObject3); //[{teresa, 2}, {roberto, 2}, {roberto, 3}]; 31
typescript types check
1//ts file 2import {byValue, byNumber, byString} from 'sort-es' 3 4const objsArray = [{numbProp: 2, stringProp: 'a'}, {numbProp: 3, stringProp: 'f'}]; 5 6//Incorrect sort property 7const incorrectSortedArray = objsArray.sort(byValue(i => i.numbProp, byString())); 8//ts check error : Type 'number' is not assignable to type 'string'. 9 10//Correct sort type 11const sortedArray = objsArray.sort(byValue(i => i.numbProp, byNumber())) 12//ts check ok 13
MIT © Cosimo chellini
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 0/28 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More