# @fekit/message

> 环境查询插件，包括系统(OS)，客户端(APP)以及浏览器(Browser)等类型的查询。

Latest version **1.0.0** (published 2022-11-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fekit/message
pnpm add @fekit/message
yarn add @fekit/message
bun add @fekit/message
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-11-30 |
| First published | 2022-11-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 19.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | xiaojunbo |
| Maintainers | liliguo, xiaojunbo |

## Links

- npm: https://www.npmjs.com/package/@fekit/message
- npm.io page: https://npm.io/package/@fekit/message

## Recent versions

- 1.0.0 (latest) — 2022-11-30

## README

# @za/zafe-env

环境查询插件，包括系统(OS)，客户端(APP)以及浏览器(Browser)等类型的查询。

## 安装

```
npm i @za/zafe-env
```

或

```
yarn add @za/zafe-env
```

## 使用

```typescript
import env, { isWecart, isZAXD, ... } from '@za/zafe-env'

console.log(env.os) // => ios

// 判断是否在众安小贷APP客户端内
if (env.app === 'zaxd') {
  console.log('是在众安小贷内')
} else {
  console.log('不在众安小贷内')
}

// 判断当前页面是否运行在苹果手机
if (env.os === 'ios') {
  // 当前页面是运行在苹果手机
}

// 判断当前页面是否运行在微信客户端
if (env.app === 'wx') {
  // 当前是在微信中
}

// 即用判断
if (isWecart) {
  console.log('是在微信内')
}
```

## 文档

默认导出的 env 是一个对象，下面有 os,app 和 browser 三个属性

### os

| 返回值  | 类型   | 说明     |
| :------ | ------ | -------- |
| mac     | String | MacOS    |
| win     | String | windows  |
| ios     | String | IOS      |
| android | String | 安卓     |
| null    | Null   | 其它未知 |

### app

| 返回值 | 类型   | 说明           |
| :----- | ------ | -------------- |
| zaxd   | String | 众安小贷客户端 |
| zadd   | String | 众安点点客户端 |
| wx     | String | 微信客户端     |
| qq     | String | QQ 客户端      |
| weibo  | String | 微博客户端     |
| null   | Null   | 其它未知       |

### browser

| 返回值  | 类型   | 说明         |
| :------ | ------ | ------------ |
| uc      | String | UC 浏览器    |
| firefox | String | 火狐浏览器   |
| baidu   | String | 百度浏览器   |
| chrome  | String | 谷歌浏览器   |
| maxthon | String | 傲游浏览器   |
| qq      | String | QQ 浏览器    |
| opera   | String | Opera 浏览器 |
| chrome  | String | 谷歌浏览器   |
| safari  | String | 苹果浏览器   |
| null    | Null   | 其它未知     |

### 即用判断

| 返回值        | 类型    | 说明                                                                                                      |
| :------------ | ------- | --------------------------------------------------------------------------------------------------------- |
| isAPP         | Boolean | 当前是否运行在某个 APP 内，与 `isBrowser` 正好相反                                                        |
| isZAAPP       | Boolean | 当前是否运行在某个众安的 APP 内 （众安小贷或众安点点）                                                    |
| isBrowser     | Boolean | 当前是否运行在浏览器内，与 `isAPP` 正好相反                                                               |
| isRealMac     | Boolean | 当前是否运行在苹果电脑系统 `MacOS`（通过 `platform` 判断的真实的平台信息，无法修改 `userAgent` 模拟环境） |
| isRealWin     | Boolean | 当前是否运行在微软系统 `Windows` （通过 `platform` 判断的真实的平台信息，无法修改 `userAgent` 模拟环境）  |
| isRealIOS     | Boolean | 当前是否运行在苹果手机系统 `IOS`（通过 `platform` 判断的真实的平台信息，无法修改 `userAgent` 模拟环境）   |
| isRealAndroid | Boolean | 当前是否运行在 安卓系统 `Android` （通过 `platform` 判断的真实的平台信息，无法修改 `userAgent` 模拟环境） |
| isAndroid     | Boolean | 当前是否为安卓设备 （通过 `userAgent` 判断，可以模拟环境）                                                |
| isIPhone      | Boolean | 当前是否为苹果手机设备                                                                                    |
| isIPad        | Boolean | 当前是否为苹果平板设备                                                                                    |
| isZAXD        | Boolean | 当前是否运行在众安小贷 APP 内                                                                             |
| isZADD        | Boolean | 当前是否运行在众安点点 APP 内                                                                             |
| isWechat      | Boolean | 当前是否运行在微信                                                                                        |
| isQQ          | Boolean | 当前是否运行在 QQ                                                                                         |
| isWeibo       | Boolean | 当前是否运行在微博                                                                                        |

```typescript
import {
  isAPP,
  isZAAPP,
  isBrowser,
  isRealMac,
  isRealWin,
  isRealIOS,
  isRealAndroid,
  isAndroid,
  isIPhone,
  isIPad
  isZAXD,
  isZADD,
  isWechat,
  isQQ,
  isWeibo,
} from '@fekit/env'
```

## 版本

```
v0.1.2
1、原isMac,isWin,isIOS,isAndroid改为isRealMac,isRealWin,isRealIOS,isRealAndroid，os信息通过 platform 判断无法模拟
2、新增手机设备环境识别 env.device 有 iphone, ipad 和 android，新增isAndroid，isIPhone,isIPad。可以通过修改调工台 userAgent 进行模拟
```

```
v0.1.0
1、实现核心功能
```

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