
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
environment
Advanced tools
Check which JavaScript environment your code is running in at runtime: browser, Node.js, Bun, etc
Check which JavaScript environment your code is running in at runtime
npm install environment
import {isBrowser, isNode} from 'environment';
if (isBrowser) {
console.log('Running in a browser!');
}
if (isNode) {
console.log('Running in Node.js!');
}
[!NOTE] Runtime checks should be used sparingly. Prefer conditional package exports and imports whenever possible.
isBrowserCheck if the code is running in a web browser environment.
isNodeCheck if the code is running in a Node.js environment.
isBunCheck if the code is running in a Bun environment.
isDenoCheck if the code is running in a Deno environment.
isElectronCheck if the code is running in an Electron environment.
isJsDomCheck if the code is running in a jsdom environment.
isWebWorkerCheck if the code is running in a Web Worker environment, which could be either a dedicated worker, shared worker, or service worker.
isDedicatedWorkerCheck if the code is running in a Dedicated Worker environment.
isSharedWorkerCheck if the code is running in a Shared Worker environment.
isServiceWorkerCheck if the code is running in a Service Worker environment.
isMacOsCheck if the code is running on macOS.
isWindowsCheck if the code is running on Windows.
isLinuxCheck if the code is running on Linux.
isIosCheck if the code is running on iOS.
isAndroidCheck if the code is running on Android.
FAQs
Check which JavaScript environment your code is running in at runtime: browser, Node.js, Bun, etc
The npm package environment receives a total of 22,624,703 weekly downloads. As such, environment popularity was classified as popular.
We found that environment demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.