Skip to content

Commit 63e065a

Browse files
committed
fix
1 parent ef55cb6 commit 63e065a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/core/utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ type Printers<Condition extends Record<string, boolean>> = {
44
export function createPrinter<Condition extends Record<string, boolean>>(
55
conditions: Condition
66
): Printers<Condition> {
7-
const printers = Object.values(conditions).map((condition) => {
8-
return (content: string, alt = '') => (condition ? content : alt);
9-
}) as Printers<Condition>;
7+
const printers = Object.entries(conditions).reduce((acc, [key, condition]) => {
8+
acc[key as keyof Condition] = (content: string, alt = '') => (condition ? content : alt);
9+
return acc;
10+
}, {} as Printers<Condition>);
1011

1112
return printers;
1213
}

0 commit comments

Comments
 (0)