Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bf6c2c5

Browse files
committedAug 6, 2022
fix(database): Set decimal value
fixes: #113
1 parent 452fee4 commit bf6c2c5

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed
 

‎packages/firebase-core/utils.ts

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,10 @@ export function serialize(data: any, wrapPrimitives: boolean = false): any {
1717
}
1818
case 'number': {
1919
const hasDecimals = numberHasDecimals(data);
20-
if (numberIs64Bit(data)) {
21-
if (hasDecimals) {
22-
return NSNumber.alloc().initWithDouble(data);
23-
} else {
24-
return NSNumber.alloc().initWithLongLong(data);
25-
}
20+
if (hasDecimals) {
21+
return NSNumber.alloc().initWithDouble(data);
2622
} else {
27-
if (hasDecimals) {
28-
return NSNumber.alloc().initWithFloat(data);
29-
} else {
30-
return data;
31-
}
23+
return NSNumber.alloc().initWithLongLong(data);
3224
}
3325
}
3426

@@ -79,18 +71,10 @@ export function serialize(data: any, wrapPrimitives: boolean = false): any {
7971
}
8072
case 'number': {
8173
const hasDecimals = numberHasDecimals(data);
82-
if (numberIs64Bit(data)) {
83-
if (hasDecimals) {
84-
return java.lang.Double.valueOf(data);
85-
} else {
86-
return java.lang.Long.valueOf(data);
87-
}
74+
if (hasDecimals) {
75+
return java.lang.Double.valueOf(data);
8876
} else {
89-
if (hasDecimals) {
90-
return java.lang.Float.valueOf(data);
91-
} else {
92-
return java.lang.Integer.valueOf(data);
93-
}
77+
return java.lang.Long.valueOf(data);
9478
}
9579
}
9680

0 commit comments

Comments
 (0)
Please sign in to comment.