Lodash Sammlung aus doppelten Objektschlüsseln erstellen
Ich habe die folgende Struktur:
var output = [{
"article": "BlahBlah",
"title": "Another blah"
}, {
"article": "BlahBlah",
"title": "Return of the blah"
}, {
"article": "BlahBlah2",
"title": "The blah strikes back"
}, {
"article": "BlahBlah2",
"title": "The blahfather"
}]
Von dem obigen Beispiel mit einem eleganten Einzeiler aus Lodash muss die folgende Struktur erstellt werden.
var newOutput = [{
"article": "BlahBlah",
"titles": ["Another blah", "Return of the blah"]
}, {
"article": "BlahBlah2",
"titles": ["The blah strikes back", "The blahfather"]
}]
Hilfe wie immer, wird sehr geschätzt .. Ein großes Plus für eine Erklärung, wie eine Lösung funktionieren würde.