MCPcopy Index your code
hub / github.com/NativeScript/firebase / serializeItems

Function serializeItems

packages/firebase-firestore/index.android.ts:118–195  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

116}
117
118function serializeItems(value) {
119 if (typeof value === 'string') {
120 return value;
121 }
122
123 if (typeof value === 'number') {
124 const hasDecimals = numberHasDecimals(value);
125 if (numberIs64Bit(value)) {
126 if (hasDecimals) {
127 return java.lang.Double.valueOf(value);
128 } else {
129 return java.lang.Long.valueOf(value);
130 }
131 } else {
132 if (hasDecimals) {
133 return java.lang.Float.valueOf(value);
134 } else {
135 return java.lang.Integer.valueOf(value);
136 }
137 }
138 }
139
140 if (typeof value === 'boolean') {
141 return java.lang.Boolean.valueOf(value);
142 }
143
144 if (value instanceof Date) {
145 return new java.util.Date(value.getTime());
146 }
147
148 if (value instanceof Timestamp) {
149 return value.native;
150 }
151
152 if (value instanceof GeoPoint) {
153 return value.native;
154 }
155
156 if (value instanceof FieldPath) {
157 return value.native;
158 }
159
160 if (value instanceof FieldValue) {
161 return value.native;
162 }
163
164 if (value instanceof DocumentReference) {
165 return value.native;
166 }
167
168 if (value instanceof CollectionReference) {
169 return value.native;
170 }
171
172 if (value === null) {
173 return null;
174 }
175

Callers 10

updateMethod · 0.70
setMethod · 0.70
whereMethod · 0.70
addMethod · 0.70
setMethod · 0.70
updateMethod · 0.70
arrayRemoveMethod · 0.70
arrayUnionMethod · 0.70
setMethod · 0.70
updateMethod · 0.70

Calls 5

numberHasDecimalsFunction · 0.70
numberIs64BitFunction · 0.70
valueOfMethod · 0.65
forEachMethod · 0.65
putMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…