我必须通过电话号码使用auth从用户中提取数据。我有一组用户的电话号码。
我已经编写了一个解决方案,它提供了所需的输出,但是没有终止。我该如何解决这个问题?
“ phoneNumberArray”是用户电话号码的数组。它主要与HTTP后台触发功能有关。
const user = async () => {
const getAuth = async phoneNumber => {
return auth.getUserByPhoneNumber(phoneNumber).catch(() => {
return {
phoneNumber,
uid: null,
email: '',
displayName: '',
emailVerified: false,
disabled: false,
};
});
};
const userRecord = await Promise.all(
phoneNumberArray.map(phoneNumber => {
return getAuth(phoneNumber);
}),
);
//when i console.log(userRecord) it's print the output
const x = {
'userRecord Length': userRecord.length
}
console.log(x)
return;
}
我在其他文件中这样调用了此函数常量用户= require(./文件名)user()