2022-09-07 00:26:17 +08:00
|
|
|
import { capitalize as toCapitalize } from '@vue/shared'
|
2022-02-11 11:03:15 +08:00
|
|
|
export {
|
|
|
|
camelize,
|
|
|
|
hyphenate,
|
|
|
|
hyphenate as kebabCase, // alias
|
|
|
|
} from '@vue/shared'
|
|
|
|
|
2022-02-13 22:48:42 +08:00
|
|
|
/**
|
|
|
|
* fork from {@link https://github.com/sindresorhus/escape-string-regexp}
|
|
|
|
*/
|
|
|
|
export const escapeStringRegexp = (string = '') =>
|
|
|
|
string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d')
|
2022-09-07 00:26:17 +08:00
|
|
|
|
|
|
|
// NOTE: improve capitalize types. Restore previous code after the [PR](https://github.com/vuejs/core/pull/6212) merge
|
|
|
|
export const capitalize = <T extends string>(str: T) =>
|
|
|
|
toCapitalize(str) as Capitalize<T>
|