Last active
October 15, 2022 22:32
-
-
Save jhmaster2000/bbc6bf50f16b677be5ffa0c8d46fb1b4 to your computer and use it in GitHub Desktop.
what-am-i-running-on
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// what-am-i-running-on (wairo) microlibrary v1.0.0 | |
// Simple utility to check which runtime your code is running on. | |
export default function wairo() { | |
if (typeof Deno === "object") return "deno"; | |
if (typeof process === "object") { | |
if (process.isBun === 1) return "bun"; | |
if (process.versions.v8) return "node"; | |
} | |
if (typeof std === "object" && globalThis.scriptArgs instanceof Array) return "quickjs"; | |
if (typeof jscStack === "function" && typeof jscOptions === "function") return "jsc"; | |
if (typeof d8 === "object") return "v8"; | |
if ( | |
typeof document !== "undefined" | |
&& typeof window !== "undefined" | |
) return "browser"; | |
return "unknown"; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment