Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
use .hasOwnProperty to check existence of 'format' in saved fields (#18)
Shan Hee25ed3a4a663
diff --git a/src/schemas/dataset-schema.js b/src/schemas/dataset-schema.jsindex a068fef3e..54238f55a 100644--- a/src/schemas/dataset-schema.js+++ b/src/schemas/dataset-schema.js@@ -82,7 +82,7 @@ class DatasetSchema extends Schema {// recalculate field type// because we have updated type-analyzer// we need to add format to each field- const needCalculateMeta = !fields[0].format;+ const needCalculateMeta = fields[0] && !fields[0].hasOwnProperty('format');if (needCalculateMeta) {const fieldOrder = fields.map(f => f.name);diff --git a/test/fixtures/state-saved-v1-2.js b/test/fixtures/state-saved-v1-2.jsindex f7300133b..e99ea7239 100644--- a/test/fixtures/state-saved-v1-2.js+++ b/test/fixtures/state-saved-v1-2.js@@ -5023,7 +5023,7 @@ export const stateSavedV1_2 = {{name: 'meta_data', type: 'real', format: ''},{name: 'start_ts', type: 'timestamp', format: 'x'},{name: 'end_ts', type: 'timestamp', format: 'x'},- {name: 'time string', type: 'timestamp', format: 'M/D/YYYY H:m'}+ {name: 'time string', type: 'timestamp', format: 'YYYY/M/D H:m'}]}}