embark-area-51/lib/core/runCode.js

26 lines
542 B
JavaScript
Raw Normal View History

2017-12-14 00:49:05 +00:00
/*eslint no-unused-vars: off*/
2017-03-29 17:50:05 +00:00
let Web3 = require('web3');
let web3;
2017-10-07 23:53:57 +00:00
let __mainContext;
2017-02-18 21:53:49 +00:00
// ======================
// the eval is used for evaluating some of the contact calls for different purposes
// this should be at least moved to a different process and scope
// for now it is defined here
// ======================
function doEval(code, _web3) {
if (_web3) {
2017-06-26 13:01:54 +00:00
web3 = _web3;
2017-02-18 21:53:49 +00:00
}
2017-10-07 23:53:57 +00:00
2017-10-14 00:01:35 +00:00
try {
return eval(code); // jshint ignore:line
} catch(e) {
throw new Error(e + "\n" + code);
}
2017-02-18 21:53:49 +00:00
}
module.exports = {
doEval: doEval
};