Skip to content

Instantly share code, notes, and snippets.

@diestrin
Created January 13, 2014 07:31
Show Gist options
  • Select an option

  • Save diestrin/8396061 to your computer and use it in GitHub Desktop.

Select an option

Save diestrin/8396061 to your computer and use it in GitHub Desktop.
var changeValueForPath = function (obj, path) {
var key;
path = path ? path + "." : "";
for (key in obj) {
if (Object.prototype.toString.call(obj[key]) === '[object Object]') {
obj[key] = doTheThing(obj[key], path + key);
} else {
obj[key] = path + key
}
}
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment