Package Exports
- js-runtime
- js-runtime/package.json
Readme
Detect which JavaScript runtime is being used, Bun, Deno or NodeJS.
Usage
index.ts
import { getRuntime } from "js-runtime";
console.log(getRuntime()); //node or deno or bun$ bun index.js
$ deno run index.js
$ node index.jsAPI
getRuntime
Return the current runtime.
Type: function
Returns: bun | deno | node
isBun
Type: function
Returns: boolean
isDeno
Type: function
Returns: boolean
isNode
Type: function
Returns: boolean
getRuntimeVersion
Retrieve the version used in the current runtime.
Type: function
Returns: string
runtimeSwitch
Switch based on the current runtime.
Type: function
Returns: string
runtimeImport
Dynamic import based on switch data, see runtimeSwitch.
Type: function
Returns: string