Skip to main content

constants to help determine the current runtime such as deno, bun, node, cloudflare, and browser.

Works with
This package works with Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score
76%
Published
4 weeks ago (0.0.0)

JavaScript runtime detection which is useful for writing compatability layers in modules for different runtimes.

Basic Usage

import { RUNTIME, BUN, DENO, NODE, BROWSER } from "@gnome/runtime-info";

console.log(RUNTIME);
console.log("bun", BUN);
console.log("deno", DENO);
console.log("node", NODE);
console.log("browser", BROWSER);
console.log("cloudflare", CLOUDFLARE);
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @gnome/runtime-constants

Import symbol

import * as mod from "@gnome/runtime-constants";

Add Package

npx jsr add @gnome/runtime-constants

Import symbol

import * as mod from "@gnome/runtime-constants";

Add Package

yarn dlx jsr add @gnome/runtime-constants

Import symbol

import * as mod from "@gnome/runtime-constants";

Add Package

pnpm dlx jsr add @gnome/runtime-constants

Import symbol

import * as mod from "@gnome/runtime-constants";

Add Package

bunx jsr add @gnome/runtime-constants

Import symbol

import * as mod from "@gnome/runtime-constants";