UNPKG

keys-transform

Version:

Recursive Transformation of object keys to lower, upper and camel case

16 lines (11 loc) 296 B
const camelCase = require('lodash.camelcase'); function snakeCase(str) { const camel = camelCase(str); const snake = camel.replace(/[A-Z]/g, (match) => { return `_${match.toLowerCase()}`; }) return snake; } module.exports = { snakeCase: snakeCase }