@bolttech/form-engine-core 0.0.2-beta.2 → 0.0.2-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.esm.js +17 -5
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -3256,9 +3256,12 @@ class FormCore {
3256
3256
  const result = splittedString.map(splittedStringVal => {
3257
3257
  // skip operator logic parsing and pass element directly
3258
3258
  if (splittedStringVal.length <= 1) {
3259
- return getTemplateValue(splittedStringVal[0]);
3259
+ return {
3260
+ parse: false,
3261
+ value: getTemplateValue(splittedStringVal[0])
3262
+ };
3260
3263
  }
3261
- return splittedStringVal.filter(Boolean).reduce((acc, curr) => {
3264
+ const value = splittedStringVal.filter(Boolean).reduce((acc, curr) => {
3262
3265
  if (curr.match(TEMPLATE_REGEX_OPERATOR_MATCHER)) {
3263
3266
  return `${acc}${curr}`;
3264
3267
  }
@@ -3297,12 +3300,21 @@ class FormCore {
3297
3300
  }
3298
3301
  return `${acc}${value}`;
3299
3302
  }, '');
3303
+ return {
3304
+ parse: true,
3305
+ value
3306
+ };
3300
3307
  });
3301
- return result.map(el => {
3308
+ return result.map(({
3309
+ parse,
3310
+ value
3311
+ }) => {
3302
3312
  try {
3303
- return new Function(`return ${el}`)();
3313
+ return parse ? new Function(`return ${value}`)() : value;
3304
3314
  } catch (_a) {
3305
- return el;
3315
+ console.warn(`unhandled parsing on ${expression} returning`);
3316
+ console.warn(value);
3317
+ return value;
3306
3318
  }
3307
3319
  });
3308
3320
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolttech/form-engine-core",
3
- "version": "0.0.2-beta.02",
3
+ "version": "0.0.2-beta.04",
4
4
  "module": "./index.esm.js",
5
5
  "type": "module",
6
6
  "main": "./index.esm.js",