Skip to content

Commit

Permalink
review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pomahtri committed Sep 2, 2024
1 parent 2bdd348 commit 5794b84
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -668,18 +668,20 @@ const XmlaStore = Class.inherit((function () {
return cells;
}

function preparePathValue(pathValue, dataField?) {
if (pathValue) {
const shouldWrapPathValue = isString(pathValue) && (
pathValue.includes('&') || pathValue.startsWith(`${dataField}.`)
);
pathValue = shouldWrapPathValue ? pathValue : `[${pathValue}]`;

if (dataField && pathValue.indexOf(`${dataField}.`) === 0) {
pathValue = pathValue.slice(dataField.length + 1, pathValue.length);
}
function preparePathValue(pathValue, dataField?): string | undefined {
if (!pathValue) {
return undefined;
}
return pathValue;
if (!isString(pathValue)) {
return `[${pathValue}]`;
}

const isStartedWithDataField = dataField && pathValue.startsWith(`${dataField}.`);
const preparedPath = isStartedWithDataField
? pathValue.slice(dataField.length + 1, pathValue.length)
: `[${pathValue}]`;

return preparedPath;
}

function getItem(hash, name, member?, index?) {
Expand Down

0 comments on commit 5794b84

Please sign in to comment.