2024-08-22 17:41:44 +02:00

7 lines
252 B
TypeScript

type Attributes = Record<string, string | boolean>;
export const attributes = (attributes: Attributes) =>
Object.keys(attributes)
.filter((key) => attributes[key] !== false)
.reduce((prev, key) => ({ ...prev, [key]: attributes[key] }), {});