Object not chain of ifs

Refs https://github.com/simonw/datasette/pull/2789/changes#r3453964430
This commit is contained in:
Simon Willison 2026-06-22 09:47:39 -07:00
commit a87c4ac555

View file

@ -60,17 +60,14 @@ function tableCreateColumnTypes() {
: ["text", "integer", "float", "blob"];
}
var SQLITE_COLUMN_TYPE_LABELS = {
float: "floating point number",
real: "floating point number",
blob: "blob - binary data",
};
function sqliteColumnTypeLabel(type) {
if (type === "float") {
return "floating point number";
}
if (type === "real") {
return "floating point number";
}
if (type === "blob") {
return "blob - binary data";
}
return type;
return SQLITE_COLUMN_TYPE_LABELS[type] || type;
}
function populateSqliteColumnTypeSelect(select, type, options) {