dropbear icon indicating copy to clipboard operation
dropbear copied to clipboard

Evaluate function fails if node.value is falsy

Open jasonsbarr opened this issue 4 years ago • 0 comments

Using 0 in a function, e.g. max, evaluates to NaN. Entering 0 in the REPL as a value expression evaluates to undefined. Empty string also evaluates to undefined.

I fixed it in my local copy by simply adding checks for 0 and an empty string to the evaluate function:

if (node.value) {
  return node.value;
} else if (node.value === 0) {
  return 0;
} else if (node.value === '') {
  return '""';
}

I guess I could submit a pull request, but I really just wanted to make sure you were aware in case you decided to redo this workshop or put it on somewhere else.

jasonsbarr avatar Apr 22 '20 04:04 jasonsbarr