mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
eslint: add github/array-foreach rule
This commit is contained in:
21 files changed
+59
-51
No files matched your search
@@ -142,7 +142,7 @@ class DomainModel {
|
||||
const affected = await UserModel.getMulti({ _id: { $in: uid } })
|
||||
.project<{ _id: number, mail: string, uname: string }>({ mail: 1, uname: 1 })
|
||||
.toArray();
|
||||
affected.forEach((udoc) => deleteUserCache(udoc));
|
||||
for (const udoc of affected) deleteUserCache(udoc);
|
||||
return await collUser.updateMany({ domainId, uid: { $in: uid } }, { $set: { role } }, { upsert: true });
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export async function add(data: Partial<OplogDoc> & { type: string }): Promise<O
|
||||
|
||||
function safeKeys(data: any) {
|
||||
if (['string', 'number', 'boolean'].includes(typeof data)) return data;
|
||||
if (data instanceof Array) data.forEach(safeKeys);
|
||||
if (data instanceof Array) for (const d of data) safeKeys(d);
|
||||
else if (data instanceof ObjectId) return data;
|
||||
else if (data instanceof Object) {
|
||||
for (const key in data) {
|
||||
|
||||
Reference in new issue
Block a user