fix ids blueprinter

This commit is contained in:
Lachlan Kermode
2018-12-13 12:35:27 +00:00
parent f909abfdc0
commit bbea550c87
2 changed files with 4 additions and 2 deletions

View File

@@ -32,11 +32,12 @@ export default function ids (
const itemLabels = data[0]
const fmt = fmtObj(itemLabels)
bp.resources[label] = R.clone(defaultResource)
bp.resources[label].data = []
bp.resources[label].data = {}
data.forEach((row, idx) => {
if (idx === 0) return
bp.resources[label].data[fmt(row).id] = fmt(row)
})
return bp
}

View File

@@ -37,7 +37,8 @@ export const fmtObj = R.curry(
}
}
columnNames.forEach((columnName, idx) => {
obj[fmtColName(columnName)] = row[idx]
const value = row[idx] ? row[idx] : ""
obj[fmtColName(columnName)] = value
})
return obj
}