File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -863,6 +863,8 @@ function isReadableStreamLike (stream) {
863863 )
864864}
865865
866+ const MAXIMUM_ARGUMENT_LENGTH = 65535
867+
866868/**
867869 * @see https://infra.spec.whatwg.org/#isomorphic-decode
868870 * @param {number[]|Uint8Array } input
@@ -871,13 +873,12 @@ function isomorphicDecode (input) {
871873 // 1. To isomorphic decode a byte sequence input, return a string whose code point
872874 // length is equal to input’s length and whose code points have the same values
873875 // as the values of input’s bytes, in the same order.
874- let output = ''
875876
876- for ( let i = 0 ; i < input . length ; i ++ ) {
877- output += String . fromCharCode ( input [ i ] )
877+ if ( input . length < MAXIMUM_ARGUMENT_LENGTH ) {
878+ return String . fromCharCode ( ... input )
878879 }
879880
880- return output
881+ return input . reduce ( ( previous , current ) => previous + String . fromCharCode ( current ) , '' )
881882}
882883
883884/**
You can’t perform that action at this time.
0 commit comments