@@ -190,6 +190,7 @@ class JsonStreamStringify extends Readable {
190
190
} else if ( type === 'Array' ) {
191
191
this . depth += 1 ;
192
192
obj . unread = realValue . length ;
193
+ obj . arrayLength = obj . unread ;
193
194
obj . isEmpty = ! obj . unread ;
194
195
} else if ( type . startsWith ( 'Readable' ) ) {
195
196
this . depth += 1 ;
@@ -267,8 +268,7 @@ class JsonStreamStringify extends Readable {
267
268
}
268
269
const key = current . unread . shift ( ) ;
269
270
const value = current . value [ key ] ;
270
-
271
- this . addToStack ( value , current . type === 'Object' && key , current . type === 'Array' && key , current ) ;
271
+ this . addToStack ( value , key , undefined , current ) ;
272
272
}
273
273
274
274
processArray ( current ) {
@@ -277,12 +277,11 @@ class JsonStreamStringify extends Readable {
277
277
this . removeFromStack ( current ) ;
278
278
return ;
279
279
}
280
- const index = current . value . length - key ;
280
+ const index = current . arrayLength - key ;
281
281
const value = current . value [ index ] ;
282
- /* eslint-disable no-param-reassign */
282
+ /* eslint-disable-next-line no-param-reassign */
283
283
current . unread -= 1 ;
284
- /* eslint-enable no-param-reassign */
285
- this . addToStack ( value , false , index , current ) ;
284
+ this . addToStack ( value , undefined , index , current ) ;
286
285
}
287
286
288
287
processPrimitive ( current ) {
0 commit comments