Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get unique properties from JSON object
// Turn const ARRAY = [{type: "FOO", content: "Test 0"}, {type: "BAR", content: "Test 1"}, {type: "FOO", content: "Test 2"}]
// Into ["FOO", "BAR"]
// Using getUniqueProperties(ARRAY, 'type')
getUniqueProperties = (array, property)=>{
return [ Set( => elem[property]))]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.