@@ -46,14 +46,14 @@ function dataSerialize(data?: any, wrapPrimitives?: boolean) {
46
46
}
47
47
48
48
if ( Array . isArray ( data ) ) {
49
- return NSArray . arrayWithArray ( ( data as any ) . map ( dataSerialize ) ) ;
49
+ return NSArray . arrayWithArray ( data . map ( ( el ) => dataSerialize ( el , wrapPrimitives ) ) . filter ( ( el ) => el !== null ) ) ;
50
50
}
51
51
52
- const node = { } as any ;
53
- Object . keys ( data ) . forEach ( function ( key ) {
54
- const value = data [ key ] ;
55
- node [ key ] = dataSerialize ( value , wrapPrimitives ) ;
56
- } ) ;
52
+ const node = Object . fromEntries (
53
+ Object . entries ( data )
54
+ . map ( ( [ key , value ] ) => [ key , dataSerialize ( value , wrapPrimitives ) ] )
55
+ . filter ( ( [ , value ] ) => value !== null )
56
+ ) ;
57
57
return NSDictionary . dictionaryWithDictionary ( node ) ;
58
58
}
59
59
@@ -344,7 +344,7 @@ export namespace NATIVE {
344
344
delete toPassOptions [ k ] ;
345
345
}
346
346
} ) ;
347
- const mutDict = NSMutableDictionary . alloc ( ) . initWithDictionary ( dataSerialize ( toPassOptions ) as any ) ;
347
+ const mutDict = NSMutableDictionary . alloc ( ) . initWithDictionary ( dataSerialize ( toPassOptions , true ) ) ;
348
348
349
349
nSentryOptions = SentryOptions . alloc ( ) . initWithDictDidFailWithError ( mutDict as any ) ;
350
350
@@ -386,7 +386,7 @@ export namespace NATIVE {
386
386
if ( beforeBreadcrumb ) {
387
387
const deserialized = dictToJSON ( breadcrumb . serialize ( ) ) ;
388
388
const processed = beforeBreadcrumb ( deserialized , null ) ;
389
- const serialized = dataSerialize ( processed ) as NSDictionary < string , any > ;
389
+ const serialized = dataSerialize ( processed , true ) as NSDictionary < string , any > ;
390
390
const levels = [ 'log' , 'debug' , 'info' , 'warning' , 'error' , 'fatal' ] ;
391
391
392
392
if ( processed ) {
0 commit comments