File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33## v2.4.3
44
55- Fixed replacer function receiving array keys as number instead of string
6+ - Fixed replacer function not being called for TypedArray entries
67- Improved performance to escape long strings that contain characters that need escaping
78
89## v2.4.2
Original file line number Diff line number Diff line change @@ -246,14 +246,8 @@ function configure (options) {
246246 join = `,\n${ indentation } `
247247 whitespace = ' '
248248 }
249- let maximumPropertiesToStringify = Math . min ( keyLength , maximumBreadth )
250- if ( isTypedArrayWithEntries ( value ) ) {
251- res += stringifyTypedArray ( value , join , maximumBreadth )
252- keys = keys . slice ( value . length )
253- maximumPropertiesToStringify -= value . length
254- separator = join
255- }
256- if ( deterministic ) {
249+ const maximumPropertiesToStringify = Math . min ( keyLength , maximumBreadth )
250+ if ( deterministic && ! isTypedArrayWithEntries ( value ) ) {
257251 keys = insertSort ( keys )
258252 }
259253 stack . push ( value )
Original file line number Diff line number Diff line change @@ -288,12 +288,22 @@ test('invalid replacer being ignored', function (assert) {
288288
289289test ( 'replacer removing elements' , function ( assert ) {
290290 const replacer = function ( k , v ) {
291+ assert . type ( k , 'string' )
291292 if ( k === 'remove' ) return
293+ if ( k === '0' ) typedkeysInReplacer = true
292294 return v
293295 }
294296 const obj = { f : null , remove : true , typed : new Int32Array ( 1 ) }
297+
298+ let typedkeysInReplacer = false
295299 const expected = JSON . stringify ( obj , replacer )
300+ assert . ok ( typedkeysInReplacer )
301+ typedkeysInReplacer = false
302+
296303 let actual = stringify ( obj , replacer )
304+ assert . ok ( typedkeysInReplacer )
305+ typedkeysInReplacer = false
306+
297307 assert . equal ( actual , expected )
298308
299309 obj . obj = obj
You can’t perform that action at this time.
0 commit comments