refactor(markdown-vetur): support generate webstorm types (#5900)

This commit is contained in:
neverland
2020-03-24 20:43:28 +08:00
committed by GitHub
parent 7ae3a4a1b1
commit c74fbf58a4
12 changed files with 422 additions and 226 deletions
+21
View File
@@ -0,0 +1,21 @@
// myName -> my-name
export function toKebabCase(input: string): string {
return input.replace(
/[A-Z]/g,
(val, index) => (index === 0 ? '' : '-') + val.toLowerCase()
);
}
// name `v2.0.0` -> name
export function removeVersion(str: string) {
return str.replace(/`(\w|\.)+`/g, '').trim();
}
// *boolean* -> boolean
export function formatType(type: string) {
return type.replace(/\*/g, '');
}
export function normalizePath(path: string): string {
return path.replace(/\\/g, '/');
}