mirror of https://github.com/Budibase/budibase.git
3 changed files with 18 additions and 50 deletions
@ -1,14 +0,0 @@ |
|||||
// eslint-disable-next-line no-undef
|
|
||||
const breweries = data |
|
||||
const totals = {} |
|
||||
|
|
||||
for (let brewery of breweries) { |
|
||||
const state = brewery.state |
|
||||
if (totals[state] == null) { |
|
||||
totals[state] = 1 |
|
||||
} else { |
|
||||
totals[state]++ |
|
||||
} |
|
||||
} |
|
||||
const entries = Object.entries(totals) |
|
||||
return entries.map(([state, count]) => ({ state, count })) |
|
||||
@ -1,31 +0,0 @@ |
|||||
// eslint-disable-next-line no-undef
|
|
||||
const breweries = data |
|
||||
const totals = {} |
|
||||
for (let brewery of breweries) { |
|
||||
const state = brewery.state |
|
||||
if (totals[state] == null) { |
|
||||
totals[state] = 1 |
|
||||
} else { |
|
||||
totals[state]++ |
|
||||
} |
|
||||
} |
|
||||
const stateCodes = { |
|
||||
texas: "tx", |
|
||||
colorado: "co", |
|
||||
florida: "fl", |
|
||||
iwoa: "ia", |
|
||||
louisiana: "la", |
|
||||
california: "ca", |
|
||||
pennsylvania: "pa", |
|
||||
georgia: "ga", |
|
||||
"new hampshire": "nh", |
|
||||
virginia: "va", |
|
||||
michigan: "mi", |
|
||||
maryland: "md", |
|
||||
ohio: "oh", |
|
||||
} |
|
||||
const entries = Object.entries(totals) |
|
||||
return entries.map(([state, count]) => { |
|
||||
stateCodes[state.toLowerCase()] |
|
||||
return { state, count, flag: "http://flags.ox3.in/svg/us/${stateCode}.svg" } |
|
||||
}) |
|
||||
Loading…
Reference in new issue