Created
February 5, 2017 02:41
-
-
Save gkucmierz/61f4a10cdf59ab06e93a75f764cbcdf5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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