导出布尔值优化

This commit is contained in:
2020-11-02 21:48:01 +08:00
parent 777ed03d3e
commit 9209b17b06
3 changed files with 3 additions and 1 deletions

1
.vscode/launch.json vendored
View File

@@ -8,6 +8,7 @@
"skipFiles": [ "skipFiles": [
"<node_internals>/**" "<node_internals>/**"
], ],
"cwd": "D:/work/repositories/zombie/config/新配表",
"program": "${workspaceFolder}/dist/binary.js", "program": "${workspaceFolder}/dist/binary.js",
"args": [ "args": [
"./excel-exporter.json" "./excel-exporter.json"

View File

@@ -256,7 +256,7 @@ export class TableParser {
protected get_cell_value(cell: xlsl.CellObject, type: DataType) { protected get_cell_value(cell: xlsl.CellObject, type: DataType) {
switch (type) { switch (type) {
case DataType.bool: case DataType.bool:
return cell.v as boolean == true; return cell && cell.v as boolean == true;
case DataType.int: case DataType.int:
return cell ? cell.v as number : 0; return cell ? cell.v as number : 0;
case DataType.float: case DataType.float:

View File

@@ -40,6 +40,7 @@ export class TypeScriptExporter extends TableExporter {
switch (field.type) { switch (field.type) {
case DataType.bool: case DataType.bool:
type = "boolean"; type = "boolean";
break;
case DataType.string: case DataType.string:
type = "string"; type = "string";
break; break;