File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,18 @@ export function sortKeys(obj = {}) {
2121 const keys = Object . keys ( obj ) ;
2222 if ( ! keys . length ) return undefined ;
2323 const sorted = { } ;
24- keys . sort ( ) . forEach (
24+ keys . sort (
25+ ( a , b ) => uncomment ( a ) . localeCompare ( uncomment ( b ) ) ,
26+ ) . forEach (
2527 ( key ) => {
2628 const value = obj [ key ] ;
29+ if ( Array . isArray ( value ) ) {
30+ sorted [ key ] = value ;
31+ // value.forEach((val, index) => {
32+ // sorted[`${key}.${index + 1}`] = val;
33+ // });
34+ return ;
35+ }
2736 sorted [ key ] = typeof value === 'object' ? sortKeys ( value ) : value ;
2837 } ,
2938 ) ;
@@ -37,3 +46,10 @@ export function sortKeys(obj = {}) {
3746export function isMain ( { url } ) {
3847 return nodePath . normalize ( url ) . endsWith ( process . argv [ 1 ] ) ;
3948}
49+
50+ function uncomment ( string = '' ) {
51+ if ( string . startsWith ( '//' ) ) {
52+ return string . substring ( 2 ) ;
53+ }
54+ return string ;
55+ }
You can’t perform that action at this time.
0 commit comments