UNPKG

diggy

Version:

Multi-backend DNS resolver for Node.js/Browser — supports dig, DNS over HTTPS, and native Node.js DNS.

16 lines (15 loc) 549 B
/** * Checks if the current environment is Node.js., Bun, or Deno. */ export function isServerRuntime() { return (Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]" || typeof Bun !== "undefined" || (typeof Deno !== "undefined" && typeof Deno.version !== "undefined")); } /** * Checks if the current environment is a browser. */ export function isBrowser() { return (typeof window !== "undefined" && Object.prototype.toString.call(window) === "[object Window]"); }