Skip to content

Commit 8bbafc2

Browse files
authored
branchless addComma (#590)
1 parent feecd18 commit 8bbafc2

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@ const validLargeArrayMechanisms = [
2727
'json-stringify'
2828
]
2929

30-
const addComma = `
31-
if (addComma) {
32-
json += ','
33-
} else {
34-
addComma = true
35-
}
36-
`
30+
const addComma = '!addComma && (addComma = true) || (json += \',\')'
3731

3832
function isValidSchema (schema, name) {
3933
if (!validate(schema)) {

0 commit comments

Comments
 (0)