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.
@@ -2526,6 +2526,11 @@ class Interpreter {
2526
2526
  getFn(data, expression) {
2527
2527
  return new Function('data', `with(data){return (${expression})}`).bind(undefined, safe(data));
2528
2528
  }
2529
+ getBoolFn(data, expression) {
2530
+ return new Function('data', `with(data){return Boolean(${expression})}`).bind(undefined, safeExclude(data, {
2531
+ 'Boolean': true
2532
+ }));
2533
+ }
2529
2534
  getAssignFn(data, expression) {
2530
2535
  const valueId = `value_bobe_${date32()}`;
2531
2536
  return new Function('data', valueId, `with(data){${expression}=${valueId}};`).bind(undefined, safeExclude(data, {
@@ -2563,11 +2568,9 @@ class Interpreter {
2563
2568
  switch (keyWord.value) {
2564
2569
  case 'if':
2565
2570
  if (valueIsMapKey) {
2566
- runWithPulling(() => data[value], null);
2567
- const cells = data[Keys.Meta].cells;
2568
- signal = cells.get(value);
2571
+ signal = new Computed(() => Boolean(data[value]));
2569
2572
  } else {
2570
- const fn = this.getFn(data, value);
2573
+ const fn = this.getBoolFn(data, value);
2571
2574
  signal = new Computed(fn);
2572
2575
  }
2573
2576
  break;
@@ -2587,7 +2590,7 @@ class Interpreter {
2587
2590
  return true;
2588
2591
  });
2589
2592
  } else {
2590
- const fn = valueIsMapKey ? null : this.getFn(data, value);
2593
+ const fn = valueIsMapKey ? null : this.getBoolFn(data, value);
2591
2594
  signal = new Computed(() => {
2592
2595
  let point = ifNode.preCond;
2593
2596
  while (point) {
@@ -2599,7 +2602,7 @@ class Interpreter {
2599
2602
  }
2600
2603
  point = point.preCond;
2601
2604
  }
2602
- return valueIsMapKey ? data[value] : fn();
2605
+ return valueIsMapKey ? Boolean(data[value]) : fn();
2603
2606
  });
2604
2607
  }
2605
2608
  break;