# is-env

> is-env can determine the current JavaScript running environment, and now includes 'browser', 'react-native', 'nodejs'.

Latest version **2.0.1** (published 2018-07-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install is-env
pnpm add is-env
yarn add is-env
bun add is-env
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2018-07-29 |
| First published | 2017-10-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | lizhooh |
| Maintainers | lizhooh |
| Keywords | is-env, is-browser, is-nodejs, is-react-native, is-js, is, is-type, react, nodejs, browser, is-window, window |

## Links

- npm: https://www.npmjs.com/package/is-env
- Repository: https://github.com/Lizhooh/is-env
- Homepage: https://github.com/Lizhooh/is-env#readme
- Issues: https://github.com/Lizhooh/is-env/issues
- npm.io page: https://npm.io/package/is-env

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2018-07-29
- 2.0.0 — 2018-07-21
- 1.0.1 — 2017-10-12
- 1.0.0 — 2017-10-12

## README

### is-env
`is-env` is a current detector.

Can check the `js` operating environment is `browser` or `react-native` or `nodejs` or `weapp`.

In addition to `browser`, `nodejs`, `react-native`, `weapp`, other output `unknow`.

Only ie9+ and modern browsers are supported in browsers.


<a href="https://www.npmjs.com/package/is-env"><img src="https://img.shields.io/npm/v/is-env.svg?style=flat-square"></a>
<a href="https://www.npmjs.com/package/is-env"><img src="https://img.shields.io/npm/dm/is-env.svg?style=flat-square"></a>


### install

```bash
npm install --save is-env
```

### use

```js
const isEnv = require('is-env');

isEnv('nodejs');
isEnv('react-native');
isEnv('browser');
isEnv('weapp');
```

When the parameter is a non string, output the current environment.

```js
const isEnv = require('is-env');

switch(isEnv()) {
    case 'react-native': break;
    case 'browser': break;
    case 'nodejs': break;
    case 'weapp': break;
    case 'unknow': break;
    default: break;
}
```

---
_Source: https://npm.io/package/is-env · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
