We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef55cb6 commit 63e065aCopy full SHA for 63e065a
packages/core/utils.ts
@@ -4,9 +4,10 @@ type Printers<Condition extends Record<string, boolean>> = {
4
export function createPrinter<Condition extends Record<string, boolean>>(
5
conditions: Condition
6
): Printers<Condition> {
7
- const printers = Object.values(conditions).map((condition) => {
8
- return (content: string, alt = '') => (condition ? content : alt);
9
- }) as Printers<Condition>;
+ const printers = Object.entries(conditions).reduce((acc, [key, condition]) => {
+ acc[key as keyof Condition] = (content: string, alt = '') => (condition ? content : alt);
+ return acc;
10
+ }, {} as Printers<Condition>);
11
12
return printers;
13
}
0 commit comments