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

Function deserialize

packages/firebase-core/utils.ts:112–215  ·  view source on GitHub ↗
(data: any)

Source from the content-addressed store, hash-verified

110}
111
112export function deserialize(data: any): any {
113 if (global.isIOS) {
114 if (data instanceof NSNull) {
115 return null;
116 }
117
118 if (data instanceof NSArray) {
119 let array = [];
120 for (let i = 0, n = data.count; i < n; i++) {
121 array[i] = deserialize(data.objectAtIndex(i));
122 }
123 return array;
124 }
125
126 if (data instanceof NSDictionary) {
127 let dict = {};
128 for (let i = 0, n = data.allKeys.count; i < n; i++) {
129 let key = data.allKeys.objectAtIndex(i);
130 dict[key] = deserialize(data.objectForKey(key));
131 }
132 return dict;
133 }
134
135 return data;
136 }
137
138 if (global.isAndroid) {
139 if (data === null || typeof data !== 'object') {
140 return data;
141 }
142 let store;
143
144 switch (data.getClass().getName()) {
145 case 'java.lang.String': {
146 return String(data);
147 }
148
149 case 'java.lang.Boolean': {
150 return String(data) === 'true';
151 }
152
153 case 'java.lang.Float':
154 case 'java.lang.Integer':
155 case 'java.lang.Long':
156 case 'java.lang.Double':
157 case 'java.lang.Short': {
158 return Number(data);
159 }
160
161 case 'org.json.JSONArray': {
162 store = [];
163 for (let j = 0; j < data.length(); j++) {
164 store[j] = deserialize(data.get(j));
165 }
166 break;
167 }
168 case 'org.json.JSONObject': {
169 store = {};

Callers 15

toUserCredentialFunction · 0.90
claimsMethod · 0.90
toUserCredentialFunction · 0.90
claimsMethod · 0.90
utmParametersMethod · 0.90
utmParametersMethod · 0.90
onSuccessMethod · 0.90
httpsCallableMethod · 0.90
doTransactionMethod · 0.90
exportValMethod · 0.90
valMethod · 0.90
transactionMethod · 0.90

Calls 3

getMethod · 0.65
nextMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…