convert exclude to arrow function

This commit is contained in:
Guillaume Dorce 2022-08-25 15:08:45 +02:00
parent f66befd0c7
commit a3004431fd
1 changed files with 2 additions and 2 deletions

View File

@ -3,12 +3,12 @@ import { Post } from '@/models/PostModel';
const prisma = new PrismaClient(); const prisma = new PrismaClient();
function exclude<User, Key extends keyof User>(user: User, ...keys: Key[]): User { const exclude = <User, Key extends keyof User>(user: User, ...keys: Key[]): User => {
for (let key of keys) { for (let key of keys) {
delete user[key]; delete user[key];
} }
return user; return user;
} };
const getAllPosts = async (): Promise<PrismaPost[]> => { const getAllPosts = async (): Promise<PrismaPost[]> => {
const posts = prisma.post.findMany({ const posts = prisma.post.findMany({