Skip to content

Instantly share code, notes, and snippets.

@thdxr
Created October 10, 2015 06:27
Show Gist options
  • Save thdxr/b273888584532fb7e234 to your computer and use it in GitHub Desktop.
Save thdxr/b273888584532fb7e234 to your computer and use it in GitHub Desktop.
Neo4j simplify results
simplify = item => {
if (typeof item !== 'object')
return item
const result = {}
for (let key in item) {
const value = item[key]
if (value instanceof Array && typeof value !== 'string') {
result[key] = value.map(this.simplify)
continue
}
result[key] = value.properties || this.simplify(value)
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment