Skip to content

Commit

Permalink
Remove environment checking variables from docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane committed Dec 5, 2023
1 parent 96d3b74 commit 73bd47b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/js/environments.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
// @ts-nocheck

/** @private */
export const IN_NODE =
typeof process === "object" &&
typeof process.versions === "object" &&
typeof process.versions.node === "string" &&
typeof process.browser ===
"undefined"; /* This last condition checks if we run the browser shim of process */

/** @private */
export const IN_NODE_COMMONJS =
IN_NODE &&
typeof module !== "undefined" &&
typeof module.exports !== "undefined" &&
typeof require !== "undefined" &&
typeof __dirname !== "undefined";

/** @private */
export const IN_NODE_ESM = IN_NODE && !IN_NODE_COMMONJS;

/** @private */
export const IN_DENO = typeof Deno !== "undefined"; // just in case...

/** @private */
export const IN_BROWSER = !IN_NODE && !IN_DENO;

/** @private */
export const IN_BROWSER_MAIN_THREAD =
IN_BROWSER &&
typeof window !== "undefined" &&
typeof document !== "undefined" &&
typeof document.createElement !== "undefined" &&
typeof sessionStorage !== "undefined";

/** @private */
export const IN_BROWSER_WEB_WORKER =
IN_BROWSER &&
typeof importScripts !== "undefined" &&
Expand Down

0 comments on commit 73bd47b

Please sign in to comment.