File tree Expand file tree Collapse file tree 1 file changed +18
-13
lines changed
Expand file tree Collapse file tree 1 file changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -9412,28 +9412,33 @@ S.splitName = titles => s => {
94129412} ;
94139413
94149414
9415- S . splitMergedWords = exceptions => s => {
9416- const xs = s . split ( " " ) . reduce ( ( acc , s2 ) =>
9417- A . pushn ( s2 . split ( / (?< = \p{ Ll} ) (? = \p{ Lu} ) / v) ) ( acc ) , [ ] ) ;
9415+ S . splitMergedWord = ( ...exceptions ) => s => {
9416+ const xs = s . split ( / (?< = \p{ Ll} ) (? = \p{ Lu} ) / v) ;
94189417
9419- const ys = [ ] ;
9418+ if ( xs . length === 1 ) return s ;
94209419
9421- for ( let i = 0 ; i < xs . length ; i ++ ) {
9422- for ( const exception of exceptions ) {
9423- if ( R . v ( `\\b${ R . escape ( exception ) } $` ) . test ( xs [ i ] ) ) {
9424- if ( i < xs . length - 1 ) {
9425- ys . push ( xs [ i ] + xs [ i + 1 ] ) ;
9426- i ++ ;
9420+ else if ( exceptions . length ) {
9421+ const ys = [ ] ;
9422+
9423+ for ( let i = 0 ; i < xs . length ; i ++ ) {
9424+ for ( const exception of exceptions ) {
9425+ if ( R . v ( `\\b${ R . escape ( exception ) } $` ) . test ( xs [ i ] ) ) {
9426+ if ( i < xs . length - 1 ) {
9427+ ys . push ( xs [ i ] + xs [ i + 1 ] ) ;
9428+ i ++ ;
9429+ }
9430+
9431+ else ys . push ( xs [ i ] ) ;
94279432 }
94289433
94299434 else ys . push ( xs [ i ] ) ;
94309435 }
9431-
9432- else ys . push ( xs [ i ] ) ;
94339436 }
9437+
9438+ return ys . join ( " " ) ;
94349439 }
94359440
9436- return ys . join ( " " ) ;
9441+ else return xs . join ( " " ) ;
94379442} ;
94389443
94399444
You can’t perform that action at this time.
0 commit comments