mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-14 10:00:58 +08:00
15 lines
563 B
TypeScript
15 lines
563 B
TypeScript
import { camelize, hyphenate, capitalize as toCapitalize } from '@vue/shared'
|
|
|
|
export { camelize, hyphenate }
|
|
export const kebabCase = hyphenate
|
|
|
|
/**
|
|
* fork from {@link https://github.com/sindresorhus/escape-string-regexp}
|
|
*/
|
|
export const escapeStringRegexp = (string = '') =>
|
|
string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d')
|
|
|
|
// 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>
|