mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
15 lines
431 B
TypeScript
15 lines
431 B
TypeScript
export const upperCase = (str: string): string => {
|
|
return str.split(/-|\s+/).filter(Boolean).map((s: string) => {
|
|
return s[0].toUpperCase() + s.slice(1)
|
|
}).join('')
|
|
}
|
|
|
|
export const lowerCase = (str: string): string => {
|
|
str = upperCase(str)
|
|
return str[0].toLowerCase() + str.slice(1)
|
|
}
|
|
|
|
export const packageName = (name: string): string => {
|
|
return 'plugin-' + name.trim().split(/-|\s+/).filter(Boolean).join('-')
|
|
}
|