bobe 0.0.74 → 0.0.75

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.
package/dist/bobe.esm.js CHANGED
@@ -2499,6 +2499,11 @@ class Interpreter {
2499
2499
  getFn(data, expression) {
2500
2500
  return new Function('data', `with(data){return (${expression})}`).bind(undefined, safe(data));
2501
2501
  }
2502
+ getBoolFn(data, expression) {
2503
+ return new Function('data', `with(data){return Boolean(${expression})}`).bind(undefined, safeExclude(data, {
2504
+ 'Boolean': true
2505
+ }));
2506
+ }
2502
2507
  getAssignFn(data, expression) {
2503
2508
  const valueId = `value_bobe_${date32()}`;
2504
2509
  return new Function('data', valueId, `with(data){${expression}=${valueId}};`).bind(undefined, safeExclude(data, {
@@ -2536,11 +2541,9 @@ class Interpreter {
2536
2541
  switch (keyWord.value) {
2537
2542
  case 'if':
2538
2543
  if (valueIsMapKey) {
2539
- runWithPulling(() => data[value], null);
2540
- const cells = data[Keys.Meta].cells;
2541
- signal = cells.get(value);
2544
+ signal = new Computed(() => Boolean(data[value]));
2542
2545
  } else {
2543
- const fn = this.getFn(data, value);
2546
+ const fn = this.getBoolFn(data, value);
2544
2547
  signal = new Computed(fn);
2545
2548
  }
2546
2549
  break;
@@ -2560,7 +2563,7 @@ class Interpreter {
2560
2563
  return true;
2561
2564
  });
2562
2565
  } else {
2563
- const fn = valueIsMapKey ? null : this.getFn(data, value);
2566
+ const fn = valueIsMapKey ? null : this.getBoolFn(data, value);
2564
2567
  signal = new Computed(() => {
2565
2568
  let point = ifNode.preCond;
2566
2569
  while (point) {
@@ -2572,7 +2575,7 @@ class Interpreter {
2572
2575
  }
2573
2576
  point = point.preCond;
2574
2577
  }
2575
- return valueIsMapKey ? data[value] : fn();
2578
+ return valueIsMapKey ? Boolean(data[value]) : fn();
2576
2579
  });
2577
2580
  }
2578
2581
  break;