mirror of
https://github.com/gorules/zen.git
synced 2026-10-04 16:02:18 +00:00
* feat: function v2 * expose evaluate * remove async trait, add caching * fix naming * add reverse compatibility * add http module * update impl * resolve issues with reqwest * fix * fix * fix ssl * remove unused deps * fix: tests * fix
26 lines
586 B
JavaScript
26 lines
586 B
JavaScript
import 'dayjs';
|
|
import 'big';
|
|
|
|
const log = [];
|
|
|
|
globalThis.console = {
|
|
log: (...args) => {
|
|
try {
|
|
log.push({
|
|
msSinceRun: Date.now() - now,
|
|
lines: args.map(a => JSON.stringify(a))
|
|
});
|
|
} catch (e) {
|
|
log.push({
|
|
msSinceRun: Date.now() - now,
|
|
lines: [JSON.stringify('failed to parse logging line')]
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
globalThis.main = (input) => JSON.stringify({
|
|
output: handler(input, {moment: dayjs, dayjs: dayjs, Big: Big, env: {}}),
|
|
log,
|
|
});
|