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

Function createDictionary

packages/firebase-firestore/index.ios.ts:147–171  ·  view source on GitHub ↗
(dataOrField: any, fieldPathValue?: any, moreFieldsAndValues?: any)

Source from the content-addressed store, hash-verified

145}
146
147function createDictionary(dataOrField: any, fieldPathValue?: any, moreFieldsAndValues?: any) {
148 const data = NSMutableDictionary.alloc().init();
149
150 const assignKeyValue = (key, val) => {
151 // check the map for weak object
152 if (typeof key === 'string' && key.includes('FIRFieldPath')) {
153 const ref = fp_refs.get(key)?.get?.();
154 if (ref) {
155 data.setObjectForKey(serializeItems(val), ref);
156 return;
157 }
158 }
159 data.setObjectForKey(serializeItems(val), key instanceof FieldPath ? key.native : key);
160 };
161 if (!fieldPathValue && !moreFieldsAndValues) {
162 Object.entries(dataOrField).forEach((item) => assignKeyValue(item[0], item[1]));
163 } else {
164 assignKeyValue(dataOrField, fieldPathValue);
165 if (Array.isArray(moreFieldsAndValues)) {
166 Object.entries(Object.fromEntries(moreFieldsAndValues)).forEach(([key, value]) => assignKeyValue(key, value));
167 }
168 }
169
170 return data;
171}
172
173export class Transaction implements ITransaction {
174 _native: FIRTransaction;

Callers 3

updateMethod · 0.70
updateMethod · 0.70
updateMethod · 0.70

Calls 3

assignKeyValueFunction · 0.85
forEachMethod · 0.65
initMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…