Skip to content

Instantly share code, notes, and snippets.

@gcmatheusj
Created April 16, 2020 16:15
Show Gist options
  • Save gcmatheusj/afa8b23c2854ef165d393e50c6fe0661 to your computer and use it in GitHub Desktop.
Save gcmatheusj/afa8b23c2854ef165d393e50c6fe0661 to your computer and use it in GitHub Desktop.
const data = [
[
null,
[
"434",
3214,
"Site CrediHome"
]
],
[
"won",
[
"10",
3214,
"Site CrediHome"
]
],
[
"lost",
[
"7",
3214,
"Site CrediHome"
],
[
"7",
3214,
"Site CrediHome"
],
[
"7",
3214,
"Site CrediHome"
]
],
[
"no_contact",
[
"6",
3214,
"Site CrediHome"
]
],
[
"deleted",
[
"4",
3214,
"Site CrediHome"
]
]
]
data
const test = data.map(bla => {
return { type: bla[0], leads: parseInt(bla[1][0]) }
})
test.filter(t => ['won', 'deleted', 'lost'].includes(t.type))
console.log(test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment