This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/lib/es6_module_transpiler/support/es6_node_runner.js

23 lines
526 B
JavaScript

(function(program, execJS) { execJS(program) })(function(module, exports, console) {
#{source}
}, function(program) {
var output, print = function(string) {
process.stdout.write('' + string);
};
try {
result = program();
if (typeof result == 'undefined' && result !== null) {
print('["ok"]');
} else {
try {
print(JSON.stringify(['ok', result]));
} catch (err) {
print('["err"]');
}
}
} catch (err) {
print(JSON.stringify(['err', '' + err]));
}
});