Skip to content

Commit

Permalink
WIP: Saving progress #7031
Browse files Browse the repository at this point in the history
  • Loading branch information
wszymanski committed Jul 9, 2020
1 parent 47daf47 commit ebe3261
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/dataMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,18 @@ class DataMap {

const physicalColumn = this.instance.toPhysicalColumn(column);

// Beyond the table boundaries. // TODO: This conditional may be temporary.
if (physicalColumn === null) {
return null;
}

// Cached property.
if (this.colToPropCache && isDefined(this.colToPropCache[physicalColumn])) {
return this.colToPropCache[physicalColumn];
}

return physicalColumn;
return column;
}

/**
* Translates property into visual column index.
*
* @param {string|number} prop Column property which may be also a physical column index.
* @param {string|number} prop Column property which may be also a visual column index.
* @returns {string|number|null} Visual column index or passed argument.
*/
propToCol(prop) {
Expand All @@ -228,8 +223,8 @@ class DataMap {
return this.instance.toVisualColumn(cachedPhysicalIndex);
}

// Property may be a physical column index.
return this.instance.toVisualColumn(prop);
// Property may be a visual column index.
return prop;
}

/**
Expand Down Expand Up @@ -620,7 +615,13 @@ class DataMap {

// try to get value under property `prop` (includes dot)
if (dataRow && dataRow.hasOwnProperty && hasOwnProperty(dataRow, prop)) {
value = dataRow[prop];
let property = prop;

if (Number.isInteger(prop)) {
property = this.instance.toPhysicalColumn(prop); // Property being a string is equivalent to a physical column index.
}

value = dataRow[property];

} else if (typeof prop === 'string' && prop.indexOf('.') > -1) {
const sliced = prop.split('.');
Expand Down

0 comments on commit ebe3261

Please sign in to comment.