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) {
863
863
)
864
864
}
865
865
866
+ const MAXIMUM_ARGUMENT_LENGTH = 65535
867
+
866
868
/**
867
869
* @see https://infra.spec.whatwg.org/#isomorphic-decode
868
870
* @param {number[]|Uint8Array } input
@@ -871,13 +873,12 @@ function isomorphicDecode (input) {
871
873
// 1. To isomorphic decode a byte sequence input, return a string whose code point
872
874
// length is equal to input’s length and whose code points have the same values
873
875
// as the values of input’s bytes, in the same order.
874
- let output = ''
875
876
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 )
878
879
}
879
880
880
- return output
881
+ return input . reduce ( ( previous , current ) => previous + String . fromCharCode ( current ) , '' )
881
882
}
882
883
883
884
/**
You can’t perform that action at this time.
0 commit comments