2019-12-04 20:38:33 +05:30
|
|
|
/**
|
|
|
|
* Merges the statisticsLabels with the state's data
|
|
|
|
* and returns an array of the following form:
|
|
|
|
* [{ key: "forks", label: "Forks", value: 50 }]
|
|
|
|
*/
|
2021-03-08 18:12:59 +05:30
|
|
|
export const getStatistics = (state) => (labels) =>
|
|
|
|
Object.keys(labels).map((key) => {
|
2019-12-04 20:38:33 +05:30
|
|
|
const result = {
|
|
|
|
key,
|
|
|
|
label: labels[key],
|
|
|
|
value: state.statistics && state.statistics[key] ? state.statistics[key] : null,
|
|
|
|
};
|
|
|
|
return result;
|
|
|
|
});
|