Last active
February 7, 2017 19:05
-
-
Save keyserfaty/04fc207553415e38ccdb073cb691bcef to your computer and use it in GitHub Desktop.
extractEndpointNames
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
function extractEndpointNames (json) { | |
function recurExtract (json, result) { | |
for (let key in json[0]) { | |
if (Array.isArray(json[0][key])) { | |
recurExtract( | |
json[0][key], | |
result | |
) | |
} else { | |
if (key === 'args') { | |
result.push(json[0][key].name) | |
recurExtract( | |
json[0][key], | |
result | |
) | |
} | |
} | |
} | |
return result | |
} | |
return recurExtract(json, []) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment