Last active
February 10, 2017 13:57
-
-
Save rmuratov/e65ec03cbc20cd3f6ba72d0e609e21e4 to your computer and use it in GitHub Desktop.
This file contains 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
input = | |
a: | |
b: 'one' | |
d: 'two' | |
f: g: 'three' | |
bb: 'four' | |
dd: 'five' | |
gg: | |
jj: 'six' | |
as: 'seven' | |
dfh: wsg: seg: wet: | |
ger: 'eight' | |
hhh: 'nine' | |
do goDeeper = (obj = input, prevKey = '') -> | |
for key, val of obj | |
currKey = "#{prevKey}#{key}" | |
switch typeof val | |
when 'string' | |
console.log currKey | |
when 'object' | |
goDeeper val, "#{currKey}." | |
return | |
### | |
'a.b', | |
'a.d', | |
'a.f.g', | |
'bb', | |
'dd', | |
'gg.jj', | |
'gg.as', | |
'gg.dfh.wsg.seg.wet.ger', | |
'gg.dfh.wsg.seg.wet.hhh' | |
### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The same in python3