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