Skip to content

Commit 036e1d5

Browse files
committed
refactor: Use lodash.camelCase() instead of self code
1 parent 0a0ea06 commit 036e1d5

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/libs/generateComponent.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,7 @@ const addAttribute = (domName: string, sub: XmlData['svg']['symbol'][number]['pa
219219
template += `\n${whitespace(counter.baseIdent + 4)}${attributeName}={getIconColor(color, ${counter.colorIndex}, '${sub.$[attributeName]}')}`;
220220
counter.colorIndex += 1;
221221
} else {
222-
// convert attribute name to camel case, e.g fill-opacity to fillOpacity
223-
const reg = /-(\w)/g;
224-
const camelAttributeName = attributeName.replace(reg, (_a,b) => b.toUpperCase());
225-
template += `\n${whitespace(counter.baseIdent + 4)}${camelAttributeName}="${sub.$[attributeName]}"`;
222+
template += `\n${whitespace(counter.baseIdent + 4)}${camelCase(attributeName)}="${sub.$[attributeName]}"`;
226223
}
227224
}
228225
}

0 commit comments

Comments
 (0)