11// helper function to output a clearer visualization
22// of the current node and its descendents
33
4+ const localeCompare = require ( '@isaacs/string-locale-compare' ) ( 'en' )
45const util = require ( 'util' )
56const relpath = require ( './relpath.js' )
67
@@ -67,14 +68,14 @@ class ArboristNode {
6768 // edgesOut sorted by name
6869 if ( tree . edgesOut . size ) {
6970 this . edgesOut = new Map ( [ ...tree . edgesOut . entries ( ) ]
70- . sort ( ( [ a ] , [ b ] ) => a . localeCompare ( b , 'en' ) )
71+ . sort ( ( [ a ] , [ b ] ) => localeCompare ( a , b ) )
7172 . map ( ( [ name , edge ] ) => [ name , new EdgeOut ( edge ) ] ) )
7273 }
7374
7475 // edgesIn sorted by location
7576 if ( tree . edgesIn . size ) {
7677 this . edgesIn = new Set ( [ ...tree . edgesIn ]
77- . sort ( ( a , b ) => a . from . location . localeCompare ( b . from . location , 'en' ) )
78+ . sort ( ( a , b ) => localeCompare ( a . from . location , b . from . location ) )
7879 . map ( edge => new EdgeIn ( edge ) ) )
7980 }
8081
@@ -86,14 +87,14 @@ class ArboristNode {
8687 // fsChildren sorted by path
8788 if ( tree . fsChildren . size ) {
8889 this . fsChildren = new Set ( [ ...tree . fsChildren ]
89- . sort ( ( { path : a } , { path : b } ) => a . localeCompare ( b , 'en' ) )
90+ . sort ( ( { path : a } , { path : b } ) => localeCompare ( a , b ) )
9091 . map ( tree => printableTree ( tree , path ) ) )
9192 }
9293
9394 // children sorted by name
9495 if ( tree . children . size ) {
9596 this . children = new Map ( [ ...tree . children . entries ( ) ]
96- . sort ( ( [ a ] , [ b ] ) => a . localeCompare ( b , 'en' ) )
97+ . sort ( ( [ a ] , [ b ] ) => localeCompare ( a , b ) )
9798 . map ( ( [ name , tree ] ) => [ name , printableTree ( tree , path ) ] ) )
9899 }
99100 }
0 commit comments