Skip to content

Instantly share code, notes, and snippets.

@keyserfaty
Last active February 7, 2017 19:05
Show Gist options
  • Save keyserfaty/04fc207553415e38ccdb073cb691bcef to your computer and use it in GitHub Desktop.
Save keyserfaty/04fc207553415e38ccdb073cb691bcef to your computer and use it in GitHub Desktop.
extractEndpointNames
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