Skip to content

Commit

Permalink
chore(naturalSort): export comparator
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Nov 15, 2024
1 parent 9060b19 commit 3014ea3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/naturalSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@
*/

/* typescript
* export declare function naturalSort<T extends any[]>(arr: T): T;
* export declare namespace naturalSort {
* interface INaturalSort {
* <T extends any[]>(arr: T): T;
* comparator(a: any, b: any): number;
* }
* }
* export declare const naturalSort: naturalSort.INaturalSort;
*/

_('startWith root toStr');
Expand All @@ -27,6 +33,8 @@ exports = function(arr) {
return arr.sort(naturalOrderComparator);
};

exports.comparator = naturalOrderComparator;

// https://github.com/ChromeDevTools/devtools-frontend
function naturalOrderComparator(a, b) {
a = toStr(a);
Expand Down

0 comments on commit 3014ea3

Please sign in to comment.