Skip to content

Instantly share code, notes, and snippets.

@rileybracken
Last active September 28, 2017 22:16
Show Gist options
  • Save rileybracken/33d207615ee995a758c8465f21e281ce to your computer and use it in GitHub Desktop.
Save rileybracken/33d207615ee995a758c8465f21e281ce to your computer and use it in GitHub Desktop.
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