File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -198,11 +198,39 @@ globalScope["changetype"] = function changetype(value) {
198198} ;
199199
200200String [ "fromCharCodes" ] = function fromCharCodes ( arr ) {
201- return String . fromCharCode . apply ( String , arr ) ;
201+ const CHUNKSIZE = 1 << 13 ;
202+ const len = arr . length ;
203+ if ( len <= CHUNKSIZE ) {
204+ return String . fromCharCode . apply ( String , arr ) ;
205+ }
206+ let index = 0 ;
207+ let parts = '' ;
208+ while ( index < len ) {
209+ parts += String . fromCharCode . apply (
210+ String ,
211+ arr . slice ( index , Math . min ( index + CHUNKSIZE , len ) )
212+ ) ;
213+ index += CHUNKSIZE ;
214+ }
215+ return parts ;
202216} ;
203217
204218String [ "fromCodePoints" ] = function fromCodePoints ( arr ) {
205- return String . fromCodePoint . apply ( String , arr ) ;
219+ const CHUNKSIZE = 1 << 13 ;
220+ const len = arr . length ;
221+ if ( len <= CHUNKSIZE ) {
222+ return String . fromCodePoint . apply ( String , arr ) ;
223+ }
224+ let index = 0 ;
225+ let parts = '' ;
226+ while ( index < len ) {
227+ parts += String . fromCodePoint . apply (
228+ String ,
229+ arr . slice ( index , Math . min ( index + CHUNKSIZE , len ) )
230+ ) ;
231+ index += CHUNKSIZE ;
232+ }
233+ return parts ;
206234} ;
207235
208236if ( ! String . prototype . replaceAll ) {
You can’t perform that action at this time.
0 commit comments