Skip to content

Instantly share code, notes, and snippets.

@shofetim
Created June 23, 2017 19:52
Show Gist options
  • Save shofetim/7bc22caf09f2b68aedda191232a9f598 to your computer and use it in GitHub Desktop.
Save shofetim/7bc22caf09f2b68aedda191232a9f598 to your computer and use it in GitHub Desktop.
function parseLabel(label, r) {
const res = r || [];
res.push(label.label_name.replace(/[,\s]+$/g, '').trim())
if (label.label_child) {
parseLabel(label.label_child, res)
}
return res.join(', ');
}
classifications = parseLabel(result._source.classifications[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment