Moved inline cacultion regex to a constant to ensure constistency

This commit is contained in:
Stefan Zermatten
2021-02-16 10:14:26 +02:00
parent 2776850311
commit 299f5a06dd
3 changed files with 8 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import evaluateCalculation from '/imports/api/creature/computation/engine/evaluateCalculation.js';
import INLINE_CALCULATION_REGEX from '/imports/constants/INLINE_CALCULTION_REGEX.js';
import ErrorNode from '/imports/parser/parseTree/ErrorNode.js';
import { union } from 'lodash';
@@ -14,7 +15,7 @@ export default function computeInlineCalculations(prop, memo){
function computeInlineCalcsForField(prop, memo, field){
let string = prop[field];
let inlineComputations = [];
let matches = string.matchAll(/\{([^{}]*)\}/g);
let matches = string.matchAll(INLINE_CALCULATION_REGEX);
for (let match of matches){
let calculation = match[1];
let {