UNPKG

@nex-ui/utils

Version:

Utility functions for React components.

9 lines (7 loc) 243 B
function kebabCase(str) { if (typeof str !== 'string' || str.trim() === '') { return str; } return str.replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2').replace(/([a-z\d])([A-Z])/g, '$1-$2').toLowerCase(); } export { kebabCase };