@domql/utils
Advanced tools
Comparing version 2.3.146 to 2.3.147
@@ -36,14 +36,17 @@ "use strict"; | ||
if (parentPath) { | ||
const parentLevels = parentPath.split("../").filter(Boolean).length; | ||
const parentLevels = parentPath.match(/\.\.\//g).length; | ||
let parentState = state; | ||
for (let i = 0; i < parentLevels; i++) { | ||
parentState = parentState.parent; | ||
if (!parentState) { | ||
return ""; | ||
} | ||
} | ||
const value = parentState[variable.trim()]; | ||
return value ? `${value}` : ""; | ||
return value !== void 0 ? `${value}` : ""; | ||
} else { | ||
const value = state[variable.trim()]; | ||
return value ? `${value}` : ""; | ||
return value !== void 0 ? `${value}` : ""; | ||
} | ||
}); | ||
}; |
{ | ||
"name": "@domql/utils", | ||
"version": "2.3.146", | ||
"version": "2.3.147", | ||
"license": "MIT", | ||
@@ -26,3 +26,3 @@ "type": "module", | ||
}, | ||
"gitHead": "96ed22cf144f9b80ad0532ce6af1393677b5249f", | ||
"gitHead": "88a525ab8e7fca820d53bb0c284d36bd68f3a147", | ||
"devDependencies": { | ||
@@ -29,0 +29,0 @@ "@babel/core": "^7.12.0" |
@@ -15,14 +15,17 @@ 'use strict' | ||
if (parentPath) { | ||
const parentLevels = parentPath.split('../').filter(Boolean).length | ||
const parentLevels = parentPath.match(/\.\.\//g).length | ||
let parentState = state | ||
for (let i = 0; i < parentLevels; i++) { | ||
parentState = parentState.parent | ||
if (!parentState) { | ||
return '' // Return an empty string if the parent level doesn't exist | ||
} | ||
} | ||
const value = parentState[variable.trim()] | ||
return value ? `${value}` : '' | ||
return value !== undefined ? `${value}` : '' | ||
} else { | ||
const value = state[variable.trim()] | ||
return value ? `${value}` : '' | ||
return value !== undefined ? `${value}` : '' | ||
} | ||
}) | ||
} |
44273
1329