Sign In

is-runtime

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-runtime

Detect the current JavaScript runtime environment

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

is-runtime

Detect the current JavaScript runtime environment

Install

npm install is-runtime

Usage

import detectRuntime, {isNode, isBun, isDeno} from 'is-runtime';

detectRuntime();
//=> 'node'

isNode;
//=> true

isBun;
//=> false

API

detectRuntime()

Returns 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.

isBun

Type: boolean

Whether the current runtime is Bun.

isDeno

Type: boolean

Whether the current runtime is Deno.

isNode

Type: boolean

Whether the current runtime is Node.js.

isEdgeLight

Type: boolean

Whether the current runtime is Vercel Edge Light.

isCloudflareWorkers

Type: boolean

Whether the current runtime is Cloudflare Workers.

isServiceWorker

Type: boolean

Whether the current runtime is a Service Worker.

isBrowser

Type: boolean

Whether the current runtime is a browser.

  • abort-timer - Create an AbortSignal that aborts after a timeout

License

MIT

Keywords

runtime

FAQs

Package last updated on 16 Feb 2026

Related posts