Skip to content

Instantly share code, notes, and snippets.

@jhmaster2000
Last active October 15, 2022 22:32
Show Gist options
  • Save jhmaster2000/bbc6bf50f16b677be5ffa0c8d46fb1b4 to your computer and use it in GitHub Desktop.
Save jhmaster2000/bbc6bf50f16b677be5ffa0c8d46fb1b4 to your computer and use it in GitHub Desktop.
what-am-i-running-on
// 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