@@ -65,6 +65,13 @@ export const posInf = Number.POSITIVE_INFINITY;
6565export const negInf = Number . NEGATIVE_INFINITY ;
6666
6767
68+ export const ordering = {
69+ lt : - 1 ,
70+ eq : 0 ,
71+ gt : 1
72+ } ;
73+
74+
6875/*█████████████████████████████████████████████████████████████████████████████
6976██████████████████████████████████ DEBUGGING ██████████████████████████████████
7077███████████████████████████████████████████████████████████████████████████████*/
@@ -9387,6 +9394,11 @@ S.splitAscii = s => {
93879394S . splitName = ( ...titles ) => s => {
93889395 const titles2 = [ ] ;
93899396
9397+ // fix egde case "F.Bar"
9398+
9399+ if ( / \p{ L} \. \p{ L} / v. test ( s ) )
9400+ s = s . replaceAll ( / (?< = \p{ L} ) \. (? = \p{ L} ) / gv, ". " ) ;
9401+
93909402 for ( const title of titles ) {
93919403 const rx = R . giv (
93929404 `${ R . preBound_ } ${ R . escape ( title ) } ( |${ R . sufBound_ } )`
@@ -9401,7 +9413,7 @@ S.splitName = (...titles) => s => {
94019413 // "Bar, Foo" format
94029414
94039415 if ( / , / . test ( s ) ) {
9404- const [ lastName , firstName ] = s . split ( / , + / ) ,
9416+ const [ lastName , firstName ] = s . split ( / , * / ) ,
94059417 [ firstName2 , ...middleNames ] = firstName . split ( / [ \- ] | (?< = \. ) (? = \p{ L} ) / v) ,
94069418 lastNames = lastName . split ( / [ \- ] / ) ;
94079419
@@ -9438,7 +9450,7 @@ S.splitName = (...titles) => s => {
94389450S . splitMergedWord = ( ...exceptions ) => s => {
94399451 const xs = s . split ( / (?< = \p{ Ll} ) (? = \p{ Lu} ) / v) ;
94409452
9441- if ( xs . length === 1 ) return s ;
9453+ if ( xs . length === 1 ) return xs ;
94429454
94439455 else if ( exceptions . length ) {
94449456 const ys = [ ] ;
@@ -9458,10 +9470,10 @@ S.splitMergedWord = (...exceptions) => s => {
94589470 }
94599471 }
94609472
9461- return ys . join ( " " ) ;
9473+ return ys ;
94629474 }
94639475
9464- else return xs . join ( " " ) ;
9476+ else return xs ;
94659477} ;
94669478
94679479
@@ -11451,36 +11463,41 @@ S.Ctor = {};
1145111463
1145211464// options
1145311465
11454- S . Ctor . acc = locale => ( {
11455- locale,
11466+
11467+ S . Ctor . case = {
11468+ usage : "search" ,
11469+ sensitivity : "case"
11470+ } ;
11471+
11472+
11473+ S . Ctor . accent = {
1145611474 usage : "search" ,
1145711475 sensitivity : "accent"
11458- } ) ;
11476+ } ;
1145911477
1146011478
11461- S . Ctor . base = locale => ( {
11462- locale,
11479+ S . Ctor . base = {
1146311480 usage : "search" ,
11464- sensitivity : "accent " ,
11465- } ) ;
11481+ sensitivity : "base " ,
11482+ } ;
1146611483
1146711484
1146811485// ascending order (switch arguments for descending order)
1146911486
11470- S . Ctor . cmp = opt =>
11471- new Intl . Collator ( opt . locale , opt ) . compare ;
11487+ S . Ctor . cmp = ( locale , opt ) =>
11488+ new Intl . Collator ( locale . slice ( 0 , 2 ) , opt ) . compare ;
1147211489
1147311490
1147411491// pass key as option property k
1147511492
11476- S . Ctor . cmpObj = opt => ( o , p ) =>
11477- new Intl . Collator ( opt . locale , opt ) . compare ( o [ opt . k ] , p [ opt . k ] ) ;
11493+ S . Ctor . cmpObj = ( locale , opt ) => ( o , p ) =>
11494+ new Intl . Collator ( locale . slice ( 0 , 2 ) , opt ) . compare ( o [ opt . k ] , p [ opt . k ] ) ;
1147811495
1147911496
1148011497// pass binary function as option property f
1148111498
11482- S . Ctor . cmpWith = opt => ( o , p ) =>
11483- new Intl . Collator ( opt . locale , opt ) . compare ( ...opt . f ( o , p ) ) ;
11499+ S . Ctor . cmpWith = ( locale , opt ) => ( o , p ) =>
11500+ new Intl . Collator ( locale . slice ( 0 , 2 ) , opt ) . compare ( ...opt . f ( o , p ) ) ;
1148411501
1148511502
1148611503//█████ Casing ████████████████████████████████████████████████████████████████
0 commit comments