Skip to content

Commit 1c263ee

Browse files
0o001anonrig
authored andcommitted
Update stringify.js
- Remove toString(); - Combine the boolean and bigint else if blocks
1 parent 59c7e63 commit 1c263ee

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

lib/stringify.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ function getAsPrimitive(value) {
88
if (type === "string") {
99
// Length check is handled inside encodeString function
1010
return encodeString(value);
11-
} else if (type === "bigint") {
12-
return value.toString();
13-
} else if (type === "boolean") {
14-
return value ? "true" : "false";
11+
} else if (type === "bigint" || type === "boolean") {
12+
return "" + value;
1513
} else if (type === "number" && Number.isFinite(value)) {
1614
return value < 1e21 ? "" + value : encodeString("" + value);
1715
}

0 commit comments

Comments
 (0)