@logicflow/engine
Version:
a process engine for javascript
28 lines • 943 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getExpressionResult = exports.globalScope = exports.isInNodeJS = void 0;
const tslib_1 = require("tslib");
const nodeVm_1 = require("./nodeVm");
const isInNodeJS = typeof global === 'object' && global.global === global;
exports.isInNodeJS = isInNodeJS;
const globalScope = (() => {
if (typeof self === 'object' && self.self === self) {
return self;
}
if (isInNodeJS) {
return global;
}
if (typeof globalThis === 'object') {
return globalThis;
}
return {
eval: () => undefined,
};
})();
exports.globalScope = globalScope;
const getExpressionResult = (code, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
const r = yield (0, nodeVm_1.runInNodeContext)(code, context);
return r;
});
exports.getExpressionResult = getExpressionResult;
//# sourceMappingURL=index.js.map