mirror of
https://github.com/pheralb/svgl.git
synced 2025-12-29 08:01:36 +08:00
🛠️ Refactor parseSvgFilename function for improved component name formatting; add directory and file existence checks in generate-registry
This commit is contained in:
@@ -7,9 +7,9 @@ export const parseSvgFilename = (params: ParseSvgFilename): string => {
|
||||
const { file, log } = params;
|
||||
const name = file.replace(/\.svg$/i, "");
|
||||
|
||||
let component = name.replace(/(^\w|[-_]\w)/g, (m) =>
|
||||
m.replace(/[-_]/, "").toUpperCase(),
|
||||
);
|
||||
let component = name
|
||||
.replace(/[-_\s]+(.)?/g, (_, char) => (char ? char.toUpperCase() : ""))
|
||||
.replace(/^(.)/, (char) => char.toLowerCase());
|
||||
|
||||
if (/^\d/.test(component)) {
|
||||
if (log) {
|
||||
|
||||
Reference in New Issue
Block a user