From 29b000e03c851cbc93c13f9b03c99256dafed8f3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 31 Oct 2018 11:22:49 +0900 Subject: [PATCH] Remove needless async/await --- src/models/blocking.ts | 4 ++-- src/models/drive-file.ts | 4 ++-- src/models/favorite.ts | 4 ++-- src/models/mute.ts | 4 ++-- src/models/note.ts | 4 ++-- src/models/notification.ts | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/models/blocking.ts b/src/models/blocking.ts index 02369e4036..f4929049a2 100644 --- a/src/models/blocking.ts +++ b/src/models/blocking.ts @@ -17,11 +17,11 @@ export type IBlocking = { blockerId: mongo.ObjectID; }; -export const packMany = async ( +export const packMany = ( blockings: (string | mongo.ObjectID | IBlocking)[], me?: string | mongo.ObjectID | IUser ) => { - return (await Promise.all(blockings.map(x => pack(x, me)))); + return Promise.all(blockings.map(x => pack(x, me))); }; export const pack = ( diff --git a/src/models/drive-file.ts b/src/models/drive-file.ts index 8afd170eec..5e2646a302 100644 --- a/src/models/drive-file.ts +++ b/src/models/drive-file.ts @@ -73,13 +73,13 @@ export function validateFileName(name: string): boolean { ); } -export const packMany = async ( +export const packMany = ( files: any[], options?: { detail: boolean } ) => { - return (await Promise.all(files.map(f => pack(f, options)))); + return Promise.all(files.map(f => pack(f, options))); }; /** diff --git a/src/models/favorite.ts b/src/models/favorite.ts index 909d4b932e..20176927ae 100644 --- a/src/models/favorite.ts +++ b/src/models/favorite.ts @@ -16,11 +16,11 @@ export type IFavorite = { noteId: mongo.ObjectID; }; -export const packMany = async ( +export const packMany = ( favorites: any[], me: any ) => { - return (await Promise.all(favorites.map(f => pack(f, me)))); + return Promise.all(favorites.map(f => pack(f, me))); }; /** diff --git a/src/models/mute.ts b/src/models/mute.ts index 3d8feda395..2e200bbcaa 100644 --- a/src/models/mute.ts +++ b/src/models/mute.ts @@ -17,11 +17,11 @@ export interface IMute { muteeId: mongo.ObjectID; } -export const packMany = async ( +export const packMany = ( mutes: (string | mongo.ObjectID | IMute)[], me?: string | mongo.ObjectID | IUser ) => { - return (await Promise.all(mutes.map(x => pack(x, me)))); + return Promise.all(mutes.map(x => pack(x, me))); }; export const pack = ( diff --git a/src/models/note.ts b/src/models/note.ts index 18fc0874dd..4d157e81c5 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -164,7 +164,7 @@ export const hideNote = async (packedNote: any, meId: mongo.ObjectID) => { } }; -export const packMany = async ( +export const packMany = ( notes: (string | mongo.ObjectID | INote)[], me?: string | mongo.ObjectID | IUser, options?: { @@ -172,7 +172,7 @@ export const packMany = async ( skipHide?: boolean; } ) => { - return (await Promise.all(notes.map(n => pack(n, me, options)))); + return Promise.all(notes.map(n => pack(n, me, options))); }; /** diff --git a/src/models/notification.ts b/src/models/notification.ts index 3944395baf..394e49f36a 100644 --- a/src/models/notification.ts +++ b/src/models/notification.ts @@ -51,10 +51,10 @@ export interface INotification { isRead: Boolean; } -export const packMany = async ( +export const packMany = ( notifications: any[] ) => { - return (await Promise.all(notifications.map(n => pack(n)))); + return Promise.all(notifications.map(n => pack(n))); }; /**