Fixed: Inline calculations in libarries now display as expected

This commit is contained in:
Stefan Zermatten
2021-02-24 09:46:52 +02:00
parent 3d3ec3bcf2
commit dee1265b69

View File

@@ -4,8 +4,8 @@ export default function embedInlineCalculations(string, calculations){
if (!string) return '';
if (!calculations) return string;
let index = 0;
return string.replace(INLINE_CALCULATION_REGEX, () => {
return string.replace(INLINE_CALCULATION_REGEX, substring => {
let comp = calculations && calculations[index++];
return comp && comp.result ? comp.result : string;
return (comp && 'result' in comp) ? comp.result : substring;
});
}