{
  "_id": "environment",
  "maintainers": [
    {
      "name": "sindresorhus",
      "email": "sindresorhus@gmail.com"
    }
  ],
  "keywords": [
    "runtime",
    "environment",
    "env",
    "execution",
    "engine",
    "platform",
    "context",
    "js",
    "javascript",
    "is",
    "check",
    "checking",
    "detect",
    "detection",
    "browser",
    "node",
    "bun",
    "deno",
    "electron",
    "jsdom",
    "webworker",
    "worker",
    "serviceworker",
    "macos",
    "ios",
    "iphone",
    "ipad",
    "windows",
    "linux",
    "android",
    "os",
    "operating",
    "system"
  ],
  "dist-tags": {
    "latest": "1.1.0"
  },
  "author": {
    "name": "Sindre Sorhus",
    "email": "sindresorhus@gmail.com",
    "url": "https://sindresorhus.com"
  },
  "_rev": "12-6198e3c92ac111f8fa24af5ba75ef30f",
  "description": "Check which JavaScript environment your code is running in at runtime: browser, Node.js, Bun, etc",
  "readme": "# environment\n\n> Check which JavaScript environment your code is running in at runtime\n\n## Install\n\n```sh\nnpm install environment\n```\n\n## Usage\n\n```js\nimport {isBrowser, isNode} from 'environment';\n\nif (isBrowser) {\n\tconsole.log('Running in a browser!');\n}\n\nif (isNode) {\n\tconsole.log('Running in Node.js!');\n}\n```\n\n> [!NOTE]\n> Runtime checks should be used sparingly. Prefer [conditional package exports](https://nodejs.org/api/packages.html#conditional-exports) and [imports](https://nodejs.org/api/packages.html#subpath-imports) whenever possible.\n\n## API\n\n### `isBrowser`\n\nCheck if the code is running in a web browser environment.\n\n### `isNode`\n\nCheck if the code is running in a [Node.js](https://nodejs.org) environment.\n\n### `isBun`\n\nCheck if the code is running in a [Bun](https://bun.sh) environment.\n\n### `isDeno`\n\nCheck if the code is running in a [Deno](https://deno.com) environment.\n\n### `isElectron`\n\nCheck if the code is running in an [Electron](https://www.electronjs.org) environment.\n\n### `isJsDom`\n\nCheck if the code is running in a [jsdom](https://github.com/jsdom/jsdom) environment.\n\n### `isWebWorker`\n\nCheck if the code is running in a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API#worker_global_contexts_and_functions) environment, which could be either a dedicated worker, shared worker, or service worker.\n\n### `isDedicatedWorker`\n\nCheck if the code is running in a [Dedicated Worker](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope) environment.\n\n### `isSharedWorker`\n\nCheck if the code is running in a [Shared Worker](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorkerGlobalScope) environment.\n\n### `isServiceWorker`\n\nCheck if the code is running in a [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope) environment.\n\n### `isMacOs`\n\nCheck if the code is running on macOS.\n\n### `isWindows`\n\nCheck if the code is running on Windows.\n\n### `isLinux`\n\nCheck if the code is running on Linux.\n\n### `isIos`\n\nCheck if the code is running on iOS.\n\n### `isAndroid`\n\nCheck if the code is running on Android.\n\n## Related\n\n- [is-in-ci](https://github.com/sindresorhus/is-in-ci) - Check if the process is running in a CI environment\n- [is64bit](https://github.com/sindresorhus/is64bit) - Check if the operating system CPU architecture is 64-bit or 32-bit\n- [is](https://github.com/sindresorhus/is) - Type check values\n",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/sindresorhus/environment.git"
  },
  "users": {
    "moimikey": true
  },
  "bugs": {
    "url": "https://github.com/sindresorhus/environment/issues"
  },
  "license": "MIT",
  "versions": {
    "0.0.1": {
      "author": {
        "name": "Brandon Benvie",
        "email": "brandon@bbenvie.com",
        "url": "http://bbenvie.com"
      },
      "name": "environment",
      "description": "Provides node's `process.env` object functionality as stand-alone functions instead of a C++ fake object that does weird things. As an added bonus, if running node with Proxies enabled (\"node --harmony\") it also exports a function that creates an `Environment` object that is similar to `process.env` but behaves like a real object.",
      "version": "0.0.1",
      "keywords": [
        "env",
        "environment",
        "process.env"
      ],
      "homepage": "https://github.com/Benvie/node-environment",
      "repository": {
        "type": "git",
        "url": "git://github.com/Benvie/node-environment.git"
      },
      "main": "environment.js",
      "scripts": {
        "install": "node-gyp rebuild"
      },
      "gypfile": true,
      "readme": "# Environment\n\nProvides node's `process.env` object functionality as stand-alone functions instead of a C++ fake object that does weird things. As an added bonus, if running node with Proxies enabled (\"node --harmony\") it also exports a function that creates an `Environment` object that is similar to `process.env` but behaves like a real object.\n\n# Install\n\n\t\tnpm install environment\n\n# Use\nMostly self-explanatory:\n\n* __environment.get(key)__\n* __environment.set(key, value)__\n* __environment.delete(key)__\n* __environment.enumerate()__\n\n# Environment object\nIf `Proxy` is available, due to running node using the `--harmony` flag, a constructor is exported as well which allows the creation of `Environment` objects.\n\nThese objects aren't entirely normal JavaScript objects, but they're much closer than node's `process.env`. `Environment.prototype` doesn't inherit from `Object.prototype` but it does have most of the functions from it. `toString`, `valueOf`, `isPrototypeOf`, `hasOwnProperty`, as well as `constructor` pointing to `Environment`.\n\nIt's possible to add methods to `Environment.prototype` and have them work on instances correctly. It's possible to change an instance's `__proto__` and point it to something else and also have that work correctly (though Object.getPrototypeOf may not reflect the change).\n\n```javascript\n// normal creation\nvar env = require('environment').create();\n```\n```javascript\n// or modifying the prototype\nvar Environment = require('environment');\nEnvironment.prototype.paths = function paths(){\n\treturn this.PATH.split(process.platform === 'win32' ? ';' : ':');\n}\n\nvar env = new Environment;\nconsole.log(env.paths());\n```\n",
      "_id": "environment@0.0.1",
      "dist": {
        "shasum": "1be6c909e06f63b21ff7248af0bc012ffe64b4a0",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/environment/-/environment-0.0.1.tgz",
        "integrity": "sha512-cr7wZlIoKAltYJqyc8LhegPUtCt2VWgRGi13kFB7YlSsmh4G0ESfY6D+s56OtZoGW2WeJt5AGdQHTKv/bIN6JA==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIQCQxpE0c3a9BtqZPcQEVlEAoiLdy9H4OSMmLM5YK5H9QwIgH/3j+ntI5RSo2H8oTggNwer5xtbETtmDHba+UuD2wEc="
          }
        ]
      },
      "maintainers": [
        {
          "name": "benvie",
          "email": "brandon@bbenvie.com"
        }
      ],
      "directories": {}
    },
    "0.0.2": {
      "author": {
        "name": "Brandon Benvie",
        "email": "brandon@bbenvie.com",
        "url": "http://bbenvie.com"
      },
      "name": "environment",
      "description": "Provides node's `process.env` object functionality as stand-alone functions instead of a C++ fake object that does weird things. As an added bonus, if running node with Proxies enabled (\"node --harmony\") it also exports a function that creates an `Environment` object that is similar to `process.env` but behaves like a real object.",
      "version": "0.0.2",
      "keywords": [
        "env",
        "environment",
        "process.env"
      ],
      "homepage": "https://github.com/Benvie/node-environment",
      "repository": {
        "type": "git",
        "url": "git://github.com/Benvie/node-environment.git"
      },
      "main": "environment.js",
      "scripts": {
        "install": "node-gyp rebuild"
      },
      "gypfile": true,
      "readme": "# Environment\n\nProvides node's `process.env` object functionality as stand-alone functions instead of a C++ fake object that does weird things. As an added bonus, if running node with Proxies enabled (\"node --harmony\") it also exports a function that creates an `Environment` object that is similar to `process.env` but behaves like a real object.\n\n# Install\n\n\t\tnpm install environment\n\n# Use\nMostly self-explanatory:\n\n* __environment.get(key)__\n* __environment.set(key, value)__\n* __environment.delete(key)__\n* __environment.enumerate()__\n\n# Environment object\nIf `Proxy` is available, due to running node using the `--harmony` flag, a constructor is exported as well which allows the creation of `Environment` objects.\n\nThese objects aren't entirely normal JavaScript objects, but they're much closer than node's `process.env`. `Environment.prototype` doesn't inherit from `Object.prototype` but it does have most of the functions from it. `toString`, `valueOf`, `isPrototypeOf`, `hasOwnProperty`, as well as `constructor` pointing to `Environment`.\n\nIt's possible to add methods to `Environment.prototype` and have them work on instances correctly. It's possible to change an instance's `__proto__` and point it to something else and also have that work correctly (though Object.getPrototypeOf may not reflect the change).\n\n```javascript\n// normal creation\nvar env = require('environment').create();\n```\n```javascript\n// or modifying the prototype\nvar Environment = require('environment');\nEnvironment.prototype.paths = function paths(){\n\treturn this.PATH.split(process.platform === 'win32' ? ';' : ':');\n}\n\nvar env = new Environment;\nconsole.log(env.paths());\n```\n",
      "_id": "environment@0.0.2",
      "dist": {
        "shasum": "2d82630392999501eaabb5a233c9ccc2cf99da58",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/environment/-/environment-0.0.2.tgz",
        "integrity": "sha512-HpLLIMza5laA5OhQDjgsaQR3VJeW7eTckJ6fY8BQOzKN7g1HeZx6x1cDL8Kmm3dr4dmoOhQnnaz7YHAVMKA+RA==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIDIcOimwgDRLKthpcmmjjRjSfRv82BkPYliaHmV+uixyAiBc5tUHl+ufHJiFELQNqPvEk3LYMow2yqHNL9KJWFnKDQ=="
          }
        ]
      },
      "maintainers": [
        {
          "name": "benvie",
          "email": "brandon@bbenvie.com"
        }
      ],
      "directories": {}
    },
    "1.0.0": {
      "name": "environment",
      "version": "1.0.0",
      "description": "Check which JavaScript environment your code is running in at runtime: browser, Node.js, Bun, etc",
      "license": "MIT",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/sindresorhus/environment.git"
      },
      "funding": "https://github.com/sponsors/sindresorhus",
      "author": {
        "name": "Sindre Sorhus",
        "email": "sindresorhus@gmail.com",
        "url": "https://sindresorhus.com"
      },
      "type": "module",
      "exports": {
        "types": "./index.d.ts",
        "default": "./index.js"
      },
      "sideEffects": false,
      "engines": {
        "node": ">=18"
      },
      "scripts": {
        "test": "xo && ava && tsc index.d.ts"
      },
      "keywords": [
        "runtime",
        "environment",
        "env",
        "execution",
        "engine",
        "platform",
        "context",
        "js",
        "javascript",
        "is",
        "check",
        "checking",
        "detect",
        "detection",
        "browser",
        "node",
        "bun",
        "deno",
        "electron",
        "jsdom",
        "webworker",
        "worker",
        "serviceworker"
      ],
      "devDependencies": {
        "ava": "^6.1.2",
        "typescript": "^5.4.5",
        "xo": "^0.58.0"
      },
      "_id": "environment@1.0.0",
      "gitHead": "03ba151c2e400c61acda627b096286ed23c445e0",
      "types": "./index.d.ts",
      "bugs": {
        "url": "https://github.com/sindresorhus/environment/issues"
      },
      "homepage": "https://github.com/sindresorhus/environment#readme",
      "_nodeVersion": "18.20.2",
      "_npmVersion": "10.6.0",
      "dist": {
        "integrity": "sha512-u6cXAuofxkVkkXHsBFBsYhRYjwGe5K16gv5j55kB872jJnw0dPm7WzMZ4pTeEIaXD2+G8PsQukvJ2rzqEluT/A==",
        "shasum": "73a40178302a5c12c05bb402de058a1a339b4efc",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/environment/-/environment-1.0.0.tgz",
        "fileCount": 5,
        "unpackedSize": 6690,
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQCy7aGCBaZwgBEHOQKw6om2iwJyjnpmFFZ7RcKI3jmszgIhAJg/CVmwGuP+uE/hEYSzogy8iKAQ8O5BOiFvWEHHkHwc"
          }
        ]
      },
      "_npmUser": {
        "name": "sindresorhus",
        "email": "sindresorhus@gmail.com"
      },
      "directories": {},
      "maintainers": [
        {
          "name": "benvie",
          "email": "brandon.benvie@gmail.com"
        },
        {
          "name": "sindresorhus",
          "email": "sindresorhus@gmail.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/environment_1.0.0_1714329043783_0.021114051965937852"
      },
      "_hasShrinkwrap": false
    },
    "1.1.0": {
      "name": "environment",
      "version": "1.1.0",
      "description": "Check which JavaScript environment your code is running in at runtime: browser, Node.js, Bun, etc",
      "license": "MIT",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/sindresorhus/environment.git"
      },
      "funding": "https://github.com/sponsors/sindresorhus",
      "author": {
        "name": "Sindre Sorhus",
        "email": "sindresorhus@gmail.com",
        "url": "https://sindresorhus.com"
      },
      "type": "module",
      "exports": {
        "types": "./index.d.ts",
        "default": "./index.js"
      },
      "sideEffects": false,
      "engines": {
        "node": ">=18"
      },
      "scripts": {
        "test": "xo && ava && tsc index.d.ts"
      },
      "keywords": [
        "runtime",
        "environment",
        "env",
        "execution",
        "engine",
        "platform",
        "context",
        "js",
        "javascript",
        "is",
        "check",
        "checking",
        "detect",
        "detection",
        "browser",
        "node",
        "bun",
        "deno",
        "electron",
        "jsdom",
        "webworker",
        "worker",
        "serviceworker",
        "macos",
        "ios",
        "iphone",
        "ipad",
        "windows",
        "linux",
        "android",
        "os",
        "operating",
        "system"
      ],
      "devDependencies": {
        "ava": "^6.1.3",
        "typescript": "^5.4.5",
        "xo": "^0.58.0"
      },
      "xo": {
        "rules": {
          "n/prefer-global/process": "off"
        }
      },
      "_id": "environment@1.1.0",
      "gitHead": "102e1c7e34f9d77791d323bed8c5ff79c71b1348",
      "types": "./index.d.ts",
      "bugs": {
        "url": "https://github.com/sindresorhus/environment/issues"
      },
      "homepage": "https://github.com/sindresorhus/environment#readme",
      "_nodeVersion": "20.12.2",
      "_npmVersion": "10.6.0",
      "dist": {
        "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==",
        "shasum": "8e86c66b180f363c7ab311787e0259665f45a9f1",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/environment/-/environment-1.1.0.tgz",
        "fileCount": 5,
        "unpackedSize": 8889,
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIFrPsHw0o0V4xoRvNXpGPmeWQFX4LK19K8l/sQccNf8PAiAymt3rS9nco+H3kd6pYpZaGoCOddzhmRB8J8b7vIV7FQ=="
          }
        ]
      },
      "_npmUser": {
        "name": "sindresorhus",
        "email": "sindresorhus@gmail.com"
      },
      "directories": {},
      "maintainers": [
        {
          "name": "sindresorhus",
          "email": "sindresorhus@gmail.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/environment_1.1.0_1715670140211_0.5873498122088465"
      },
      "_hasShrinkwrap": false
    }
  },
  "name": "environment",
  "time": {
    "modified": "2026-05-14T14:41:51.288Z",
    "created": "2012-06-27T23:09:47.902Z",
    "0.0.1": "2012-06-27T23:09:48.666Z",
    "0.0.2": "2012-06-28T15:34:51.604Z",
    "1.0.0": "2024-04-28T18:30:43.930Z",
    "1.1.0": "2024-05-14T07:02:20.386Z"
  },
  "readmeFilename": "readme.md",
  "homepage": "https://github.com/sindresorhus/environment#readme"
}