Skip to content

Instantly share code, notes, and snippets.

@gkucmierz
Created February 5, 2017 02:41
Show Gist options
  • Select an option

  • Save gkucmierz/61f4a10cdf59ab06e93a75f764cbcdf5 to your computer and use it in GitHub Desktop.

Select an option

Save gkucmierz/61f4a10cdf59ab06e93a75f764cbcdf5 to your computer and use it in GitHub Desktop.
var deepEach = function callee(obj, fn, chain) {
chain = chain && chain + '.' || '';
// chain += '.';
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
if (typeof obj[i] === 'object') {
callee(obj[i], fn, chain + i);
} else {
fn(obj[i], i, chain + i);
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment