Detect the current JavaScript runtime environment
npm install is-runtimeimport detectRuntime, {isNode, isBun, isDeno} from 'is-runtime';
detectRuntime();
//=> 'node'
isNode;
//=> true
isBun;
//=> falseReturns a string identifying the current runtime: 'node' | 'bun' | 'deno' | 'browser' | 'cloudflare-workers' | 'service-worker' | 'edge-light' | 'unknown'.
Detection order (first match wins): bun, deno, edge-light, cloudflare-workers, service-worker, node, browser, unknown.
Type: boolean
Whether the current runtime is Bun.
Type: boolean
Whether the current runtime is Deno.
Type: boolean
Whether the current runtime is Node.js.
Type: boolean
Whether the current runtime is Vercel Edge Light.
Type: boolean
Whether the current runtime is Cloudflare Workers.
Type: boolean
Whether the current runtime is a Service Worker.
Type: boolean
Whether the current runtime is a browser.
- abort-timer - Create an AbortSignal that aborts after a timeout
MIT