# chanjet-env-check

> 为Mutants框架提供环境检测功能

Latest version **1.0.2** (published 2019-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install chanjet-env-check
pnpm add chanjet-env-check
yarn add chanjet-env-check
bun add chanjet-env-check
```

## 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 | 1.0.2 |
| Published | 2019-05-17 |
| First published | 2016-09-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 24.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | TonyJiang |
| Maintainers | chanjetsdp |

## Links

- npm: https://www.npmjs.com/package/chanjet-env-check
- npm.io page: https://npm.io/package/chanjet-env-check

## Recent versions

- 1.0.2 (latest) — 2019-05-17
- 1.0.0 — 2016-09-13
- 0.1.3 — 2016-09-08

## README

# chanjet-env-check `v0.0.7`

环境检测对象,在运行环境初始化的时候,对运行环境进行判断,将判断结果保存,为后续使用提供方便.



## 使用

#### 安装

``` 
npm install chanjet-env-check
```

使用npm安装.



#### 启动

在应用初始化时,添加以下代码,就可以使用了.

``` javascript
import env from "chanjet-env-check"

//获取当前的操作系统: ios , android , mobile , computer
console.log(env.os);
//获取当前浏览器: chrome , firefox , safari , opera , unknown
console.log(env.browser);
//获取当前平台: weixin , chanjet , browser, yonyou
console.log(env.platform);
```



如果需要进行判断,推荐使用以下用法:

``` javascript
import env from "chanjet-env-check"


/*
*使用envInstance.constant可以避免在代码里写入死值.
*/

//判断如果操作系统是苹果
if(env.constant.os.ios == env.os){
  //insert code here
}

//判断如果平台是微信
if(env.constant.platform.weixin == env.platform){
  //insert code here
}

//判断如果浏览器是chrome
if(env.constant.browser.chrome == env.browser){
  //insert code here
}
```

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