Created
December 4, 2020 15:59
-
-
Save ghoti143/e7890c140a58fb49b8d1d17f329790d5 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 unionedData = _.union(fcas.data.data, dev.data.data, maturity.data.data, utility.data.data); | |
// reduce data.data | |
let reducer = (map, obj) => { | |
let projObj = {}; | |
if(map.hasOwnProperty(obj.project_id)) { | |
projObj = map[obj.project_id]; | |
} | |
projObj.project_id = obj.project_id; | |
projObj.project_name = obj.project_name; | |
projObj.symbol = obj.symbol; | |
projObj[obj.metric_slug] = obj.value; | |
map[obj.project_id] = projObj; | |
return map; | |
}; | |
var uniqueData = unionedData.reduce(reducer, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment