Last active
September 28, 2017 22:16
-
-
Save rileybracken/33d207615ee995a758c8465f21e281ce 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
const data = { | |
title: "company", | |
white: 44, | |
black: 3, | |
asian: 23, | |
hispanic: 5, | |
undefined: 25, | |
}; | |
// this.props.data["white"] === 44 | |
const drawArc = (data) => console.log(`Draw ${data.label} with value of ${data.value} starts at ${data.startValue}`); | |
const convertData = () => { | |
Object.keys(data).reduce((a, b) => { | |
if (b !== "title") { | |
drawArc({ | |
label: b, | |
value: data[b], | |
startValue: a, | |
}); | |
} | |
return b !== "title" ? a + data[b] : 0; | |
}, 0); | |
} | |
convertData(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment