}
// JSON.stringify all objects that do not polyfill toString()
const str = value.toString();
- if (typeof value === 'object' && (str === '[object Object]') || str === '[object Java]') {
+ if (typeof value === 'object' && (str === '[object Object]' || str === '[object Java]')) {
return JSON.stringify(value, null, 2);
}
return str;
// Polyfill common NodeJS functions onto the global object
globalThis.console = console;
globalThis.setTimeout = function (functionRef, delay, ...args) {
- ThreadsafeTimers.setTimeout(() => functionRef(...args), delay);
+ return ThreadsafeTimers.setTimeout(() => functionRef(...args), delay);
};
globalThis.clearTimeout = ThreadsafeTimers.clearTimeout;
globalThis.setInterval = function (functionRef, delay, ...args) {
- ThreadsafeTimers.setInterval(() => functionRef(...args), delay);
+ return ThreadsafeTimers.setInterval(() => functionRef(...args), delay);
};
globalThis.clearInterval = ThreadsafeTimers.clearInterval;