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
15 lines (11 loc) • 414 B
JavaScript
const toKebab = require('./toKebab');
function deepKebab(obj) {
if (typeof obj !== 'object' || obj === null) throw new Error('Input must be an object');
return Object.fromEntries(
Object.entries(obj).map(([key, value]) => [
toKebab(key),
typeof value === 'object' && value !== null ? deepKebab(value) : value
])
);
}
module.exports = deepKebab;