From 3014ea3238eab2d5cb5618ced98b8796dda58864 Mon Sep 17 00:00:00 2001 From: redhoodsu Date: Fri, 15 Nov 2024 11:48:31 +0800 Subject: [PATCH] chore(naturalSort): export comparator --- src/naturalSort.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/naturalSort.js b/src/naturalSort.js index 94147444..e4e2523c 100644 --- a/src/naturalSort.js +++ b/src/naturalSort.js @@ -18,7 +18,13 @@ */ /* typescript - * export declare function naturalSort(arr: T): T; + * export declare namespace naturalSort { + * interface INaturalSort { + * (arr: T): T; + * comparator(a: any, b: any): number; + * } + * } + * export declare const naturalSort: naturalSort.INaturalSort; */ _('startWith root toStr'); @@ -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);