File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed
Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -17,22 +17,18 @@ const mappers = {
1717 const euc = getTable ( 'euc-kr' )
1818 let lead = 0
1919
20+ const decodeLead = ( b ) => {
21+ const cp = b >= 0x41 && b <= 0xfe ? euc [ ( lead - 0x81 ) * 190 + b - 0x41 ] : undefined
22+ lead = 0
23+ if ( cp !== undefined && cp !== REP ) return String . fromCharCode ( cp )
24+ return b < 128 ? String . fromCharCode ( err ( ) , b ) : String . fromCharCode ( err ( ) )
25+ }
26+
2027 const fast = ( arr , start , end , stream ) => {
2128 let res = ''
2229 let i = start
2330
24- const decodeLead = ( b ) => {
25- const cp = b >= 0x41 && b <= 0xfe ? euc [ ( lead - 0x81 ) * 190 + b - 0x41 ] : undefined
26- lead = 0
27- if ( cp !== undefined && cp !== REP ) {
28- res += String . fromCharCode ( cp )
29- } else {
30- res += String . fromCharCode ( err ( ) )
31- if ( b < 128 ) res += String . fromCharCode ( b )
32- }
33- }
34-
35- if ( lead && i < end ) decodeLead ( arr [ i ++ ] )
31+ if ( lead && i < end ) res += decodeLead ( arr [ i ++ ] )
3632 while ( i < end ) {
3733 const b = arr [ i ++ ]
3834 if ( b < 128 ) {
@@ -41,7 +37,7 @@ const mappers = {
4137 res += String . fromCharCode ( err ( ) )
4238 } else {
4339 lead = b
44- if ( i < end ) decodeLead ( arr [ i ++ ] )
40+ if ( i < end ) res += decodeLead ( arr [ i ++ ] )
4541 }
4642 }
4743
You can’t perform that action at this time.
0 commit comments