@airtasker/form-schema-compiler
Version:
a form schema compiler
22 lines (15 loc) • 452 B
JavaScript
;
exports.__esModule = true;
// evaluate both block and program statement
var evaluateProgram = function evaluateProgram(_ref, env, evaluate) {
var body = _ref.body;
if (body.length === 0) {
return null;
}
var lstIndex = body.length - 1;
for (var i = 0; i < lstIndex; i++) {
evaluate(body[i], env);
}
return evaluate(body[lstIndex], env); // always return the last value
};
exports["default"] = evaluateProgram;