Skip to content

Commit 138c00e

Browse files
committed
refactor: simplify some conditions
1 parent 329b8ed commit 138c00e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

fallback/multi-byte.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const mappers = {
3333
const b = arr[i++]
3434
if (b < 128) {
3535
res += String.fromCharCode(b)
36-
} else if (b < 0x81 || b === 0xff) {
36+
} else if (b === 0x80 || b === 0xff) {
3737
res += String.fromCharCode(err())
3838
} else {
3939
lead = b
@@ -248,8 +248,8 @@ const mappers = {
248248
if (b <= 0x80) {
249249
res += String.fromCharCode(b) // 0x80 is allowed
250250
} else if (b >= 0xa1 && b <= 0xdf) {
251-
res += String.fromCharCode(0xff_61 - 0xa1 + b)
252-
} else if (b < 0x81 || (b > 0x9f && b < 0xe0) || b > 0xfc) {
251+
res += String.fromCharCode(0xfe_c0 + b)
252+
} else if (b === 0xa0 || b > 0xfc) {
253253
res += String.fromCharCode(err())
254254
} else {
255255
lead = b
@@ -372,7 +372,7 @@ const mappers = {
372372
const b = arr[i++]
373373
if (b < 128) {
374374
res += String.fromCharCode(b)
375-
} else if (b < 0x81 || b === 0xff) {
375+
} else if (b === 0x80 || b === 0xff) {
376376
res += String.fromCharCode(err())
377377
} else {
378378
lead = b

0 commit comments

Comments
 (0)