]> Untitled Git - lemmy-ui.git/blob - src/shared/utils/app/edit-with.ts
fix: Fix badge alignment and break out into component
[lemmy-ui.git] / src / shared / utils / app / edit-with.ts
1 import { WithComment } from "@utils/types";
2
3 export default function editWith<D extends WithComment, L extends WithComment>(
4   { comment, counts, saved, my_vote }: D,
5   list: L[]
6 ) {
7   return [
8     ...list.map(c =>
9       c.comment.id === comment.id
10         ? { ...c, comment, counts, saved, my_vote }
11         : c
12     ),
13   ];
14 }