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

Function deserializeField

packages/firebase-firestore/index.ios.ts:32–87  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

30});
31
32function deserializeField(value) {
33 if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
34 return value;
35 }
36
37 if (value instanceof FIRTimestamp) {
38 return Timestamp.fromNative(value);
39 }
40
41 if (value instanceof FIRGeoPoint) {
42 return GeoPoint.fromNative(value);
43 }
44
45 if (value instanceof FIRFieldPath) {
46 return FieldPath.fromNative(value);
47 }
48
49 if (value instanceof FIRFieldValue) {
50 return FieldValue.fromNative(value);
51 }
52
53 if (value instanceof FIRDocumentReference) {
54 return DocumentReference.fromNative(value);
55 }
56
57 if (value instanceof FIRCollectionReference) {
58 return CollectionReference.fromNative(value);
59 }
60
61 if (value instanceof NSNull) {
62 return null;
63 }
64
65 if (value instanceof NSArray) {
66 let array = [];
67 for (let i = 0, n = value.count; i < n; i++) {
68 array[i] = deserializeField(value.objectAtIndex(i));
69 }
70 return array;
71 }
72
73 if (value instanceof NSDictionary) {
74 let dict = {};
75 for (let i = 0, n = value.allKeys.count; i < n; i++) {
76 let key = value.allKeys.objectAtIndex(i);
77 dict[key] = deserializeField(value.objectForKey(key));
78 }
79 return dict;
80 }
81
82 if (value instanceof NSData) {
83 return Bytes.fromNative(value);
84 }
85
86 return value;
87}
88
89function serializeItems(value) {

Callers 5

dataMethod · 0.70
getMethod · 0.70
dataMethod · 0.70
getMethod · 0.70
runTransactionMethod · 0.70

Calls 1

fromNativeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…