# hyphenate
将驼峰字符串转换为中划线(-)字符串
import { hyphenate } from '@hui-pro/utils';
hyphenate('camelCase', upperCase); // return camel-case
TIP
由于浏览器前缀前首字母均为-xxx-,转换 css 属性名时可使用内部函数 hyphenateStyle
import { hyphenate, hyphenateStyle } from '@hui-pro/utils';
hyphenateStyle('msAnimation'); // return -ms-animation
# API
参数 | 说明 | 类型 | 默认值 | 可选值 |
---|---|---|---|---|
sting | 需要转换的字符串 | String | - | - |
upperCase | 转换值是否为大驼峰 | Boolean | false | - |