Skip to content

Instantly share code, notes, and snippets.

View mehunk's full-sized avatar
🎯
Focusing

mehunk mehunk

🎯
Focusing
View GitHub Profile
@mehunk
mehunk / camelSnake.js
Created August 20, 2018 01:50 — forked from simongong/camelSnake.js
JavaScript: convert format of object keys between camel-case and snake-case
/**
* @param {Object|String} data string or keys of object are named in form of snake
* @param {number} depth to which level of keys should it process
* @return {Object|String} string or keys of object are named in form of camel case
*/
exports.snakeToCamel = function(data, depth) {
if (Util.isObject(data)) {
if (typeof depth === 'undefined') {
depth = 1;
}