// 驼峰命名转换成短横线命名
const getKebabCase = (str) => {
return str.replace(/[A-Z]/g, (item) => '-' + item.toLowerCase())
}
// 短横线命名转换成驼峰命名
const getCamelCase = (str) => {
return str.replace(/-([a-z])/g, (i, item) => item.toUpperCase())
}
驼峰命名与短横线之间的转换
最新推荐文章于 2024-05-20 22:14:20 发布