Skip to content

Commit

Permalink
perf: improve isomorphic decode performance
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Nov 30, 2022
1 parent 232905f commit c714b89
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/fetch/util.js
Expand Up @@ -871,13 +871,8 @@ function isomorphicDecode (input) {
// 1. To isomorphic decode a byte sequence input, return a string whose code point
// length is equal to input’s length and whose code points have the same values
// as the values of input’s bytes, in the same order.
let output = ''

for (let i = 0; i < input.length; i++) {
output += String.fromCharCode(input[i])
}

return output
return input.reduce((previous, current) => previous + String.fromCharCode(current), '')
}

/**
Expand Down

0 comments on commit c714b89

Please sign in to comment.