Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tree.body = tree.body.map(line => {
if (line.type == "LabeledStatement") {
if (line.label.name == "when") {
if (line.body.type == "IfStatement") {
console.log("Valid when statement")
return computed(line.body)
}
else throw new Error("When statement must take an if condition")
}
else if (line.label.name == "set") {
return computedStatement(line.body)
}
else return line;
}
else return line;
});
Object.defineProperty(this, "rule", { value: fn => computed(fn) });
return _this;