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