MCPcopy Create free account
hub / github.com/firebase/firebase-tools / transUserToArray

Function transUserToArray

src/accountExporter.ts:72–100  ·  view source on GitHub ↗
(user: any)

Source from the content-addressed store, hash-verified

70}
71
72function transUserToArray(user: any): any[] {
73 const arrLength = Math.max(...PROVIDER_ID_INDEX_MAP.values()) + 4;
74 const arr = Array(arrLength).fill("");
75 arr[0] = user.localId;
76 arr[1] = user.email || "";
77 arr[2] = user.emailVerified || false;
78 arr[3] = convertToNormalBase64(user.passwordHash || "");
79 arr[4] = convertToNormalBase64(user.salt || "");
80 arr[5] = escapeCsv(user.displayName || "");
81 arr[6] = user.photoUrl || "";
82 for (let i = 0; i < (!user.providerUserInfo ? 0 : user.providerUserInfo.length); i++) {
83 const providerInfo = user.providerUserInfo[i];
84 if (providerInfo) {
85 const providerIndex = PROVIDER_ID_INDEX_MAP.get(providerInfo.providerId);
86 if (providerIndex) {
87 addProviderUserInfo(providerInfo, arr, providerIndex);
88 }
89 }
90 }
91 arr[23] = user.createdAt;
92 arr[24] = user.lastLoginAt;
93 arr[25] = user.phoneNumber;
94 arr[26] = user.disabled;
95 // quote entire custom claims object and escape inner quotes with quotes
96 arr[27] = user.customAttributes
97 ? `"${user.customAttributes.replace(/(?<!\\)"/g, '""')}"`
98 : user.customAttributes;
99 return arr;
100}
101
102function transUserJson(user: any): any {
103 const newUser: any = {};

Callers 1

createWriteUsersToFileFunction · 0.85

Calls 4

convertToNormalBase64Function · 0.85
escapeCsvFunction · 0.85
addProviderUserInfoFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…