Skip to content

Commit b62e022

Browse files
committed
feat: update codegen -> refactor
1 parent d596208 commit b62e022

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

codegen/index.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,14 @@ const ignoredSvgPropKeys = [
8282
"tref", "color-profile", "cursor",
8383
]
8484

85-
const camelCaseSvgProps = {}
86-
Object.keys(svgProps).forEach(elName => {
87-
if (!ignoredSvgPropKeys.includes(elName)) {
88-
const elAttrs = svgProps[elName].map(changeCase.camelCase);
89-
// style is already included in SharedSVGProps
90-
delete elAttrs['style'];
91-
camelCaseSvgProps[elName] = elAttrs;
92-
}
93-
});
85+
const camelCaseSvgProps = Object.fromEntries(
86+
Object.entries(svgProps)
87+
.filter(([elName]) => !ignoredSvgPropKeys.includes(elName)) // Exclude ignored keys
88+
.map(([elName, attrs]) => [
89+
elName,
90+
attrs.map(changeCase.camelCase).filter(attr => attr !== "style"), // Convert & filter immutably
91+
])
92+
);
9493

9594
// The attribute list for <svg> in react-html-attributes
9695
// is wrong (it contains the union of the attributes of all

0 commit comments

Comments
 (0)