@@ -190,6 +190,7 @@ class JsonStreamStringify extends Readable {
190190 } else if ( type === 'Array' ) {
191191 this . depth += 1 ;
192192 obj . unread = realValue . length ;
193+ obj . arrayLength = obj . unread ;
193194 obj . isEmpty = ! obj . unread ;
194195 } else if ( type . startsWith ( 'Readable' ) ) {
195196 this . depth += 1 ;
@@ -267,8 +268,7 @@ class JsonStreamStringify extends Readable {
267268 }
268269 const key = current . unread . shift ( ) ;
269270 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 ) ;
272272 }
273273
274274 processArray ( current ) {
@@ -277,12 +277,11 @@ class JsonStreamStringify extends Readable {
277277 this . removeFromStack ( current ) ;
278278 return ;
279279 }
280- const index = current . value . length - key ;
280+ const index = current . arrayLength - key ;
281281 const value = current . value [ index ] ;
282- /* eslint-disable no-param-reassign */
282+ /* eslint-disable-next-line no-param-reassign */
283283 current . unread -= 1 ;
284- /* eslint-enable no-param-reassign */
285- this . addToStack ( value , false , index , current ) ;
284+ this . addToStack ( value , undefined , index , current ) ;
286285 }
287286
288287 processPrimitive ( current ) {
0 commit comments