UNPKG

mr-case

Version:

55 functions to seamlessly transform strings, arrays, and object keys between different cases (camelCase, snake_case, kebab-case, PascalCase, Title Case, and more), clean and format text, extract URL components, and perform common text operations like mas

9 lines (7 loc) 224 B
function toKebab(str) { return str .replace(/([a-z])([A-Z])/g, '$1-$2') // camelCase to kebab-case .replace(/_/g, '-') // underscore to hyphen .toLowerCase(); } module.exports = toKebab;