Last active
May 11, 2017 10:35
-
-
Save xuyuji9000/f87a94a305f30b47ecc01e068fe5802d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let _ = require('lodash') | |
var data = [{ | |
"name": "jim", | |
"color": "blue", | |
"age": "22" | |
}, { | |
"name": "Sam", | |
"color": "blue", | |
"age": "33" | |
}, { | |
"name": "eddie", | |
"color": "green", | |
"age": "77" | |
}]; | |
var result = _(data) | |
.groupBy(x => x.color) | |
.value(); | |
console.log(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment