1
0
Fork 0
mirror of synced 2024-09-28 23:31:43 +12:00

Merge fix and linting

This commit is contained in:
Rory Powell 2022-01-20 16:17:09 +00:00
parent 2bc7e823d6
commit a61e1afdc3
3 changed files with 18 additions and 50 deletions

View file

@ -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 }))

View file

@ -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" }
})

View file

@ -153,8 +153,15 @@ export function isIsoDateString(str: string) {
* @param column The column to check, to see if it is a valid relationship.
* @param tableIds The IDs of the tables which currently exist.
*/
function shouldCopyRelationship(column: { type: string, tableId?: string }, tableIds: [string]) {
return column.type === FieldTypes.LINK && column.tableId && tableIds.includes(column.tableId)
function shouldCopyRelationship(
column: { type: string; tableId?: string },
tableIds: [string]
) {
return (
column.type === FieldTypes.LINK &&
column.tableId &&
tableIds.includes(column.tableId)
)
}
/**
@ -165,9 +172,15 @@ function shouldCopyRelationship(column: { type: string, tableId?: string }, tabl
* @param column The column to check for options or boolean type.
* @param fetchedColumn The fetched column to check for the type in the external database.
*/
function shouldCopySpecialColumn(column: { type: string }, fetchedColumn: { type: string } | undefined) {
return column.type === FieldTypes.OPTIONS ||
((!fetchedColumn || fetchedColumn.type === FieldTypes.NUMBER) && column.type === FieldTypes.BOOLEAN)
function shouldCopySpecialColumn(
column: { type: string },
fetchedColumn: { type: string } | undefined
) {
return (
column.type === FieldTypes.OPTIONS ||
((!fetchedColumn || fetchedColumn.type === FieldTypes.NUMBER) &&
column.type === FieldTypes.BOOLEAN)
)
}
/**