let array = [
{hash: "11223344", value: "abc"},
{hash: "11223344", value: "def"},
{hash: "22113344", value: "jkl"},
{hash: "22113344", value: "zyw"},
{hash: "33221144", value: "omn"},
{hash: "33221144", value: "xyz"}
];
let a = [...new Set(array.map(i => i.hash))]
.map(hash => {
return { hash, values: array.filter(v => v.hash == hash).map(v => v.value) }
})
console.log(a)
Created
September 24, 2018 15:26
-
-
Save andrit/25eaad5afe397e9bc307e3940a295aee to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment