Skip to content

Commit 0e81ad9

Browse files
committed
fix(core): wrap null as NSNull when wrapping primitives
1 parent 1e4c11b commit 0e81ad9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/firebase-core/utils.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ export function serialize(data: any, wrapPrimitives: boolean = false): any {
3838
}
3939

4040
if (!data) {
41-
return NSNull.new();
41+
if (wrapPrimitives) {
42+
return NSNull.new();
43+
}
44+
return null;
4245
}
4346

4447
if (Array.isArray(data)) {
@@ -54,7 +57,10 @@ export function serialize(data: any, wrapPrimitives: boolean = false): any {
5457
}
5558

5659
default:
57-
return NSNull.new();
60+
if (wrapPrimitives) {
61+
return NSNull.new();
62+
}
63+
return null;
5864
}
5965
}
6066

packages/firebase-database/index.ios.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Object.defineProperty(fb, 'database', {
1616
writable: false,
1717
});
1818

19-
function serializeItems(data, wrapPrimitives = false) {
19+
function serializeItems(data, wrapPrimitives = true) {
2020
if (data instanceof ServerValue) {
2121
return data.native;
2222
}

0 commit comments

Comments
 (0)