Detect Jstime
The recommended way to conditionally detect when code is being executed with jstime is to check for the existence of the JSTime global.
This is similar to how you’d check for the existence of the window variable to detect when code is being executed in a browser.
if (typeof JSTime !== "undefined") { // this code will only run when the file is run with JSTime}In TypeScript environments, the previous approach will result in a type error unless jstime-types is globally installed. To avoid this, you can check process.versions instead.
if (process.versions.jstime) { // this code will only run when the file is run with JSTime}