# zax-device

> zax-device

Latest version **4.0.2** (published 2020-12-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install zax-device
pnpm add zax-device
yarn add zax-device
bun add zax-device
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2020-12-17 |
| First published | 2019-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 93.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jsonchou |
| Maintainers | jsonchou |
| Keywords | zax-device, urlUtils |

## Links

- npm: https://www.npmjs.com/package/zax-device
- Repository: https://github.com/jsonchou/zax-device
- Issues: https://github.com/jsonchou/zax-device/issues
- npm.io page: https://npm.io/package/zax-device

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 4.0.2 (latest) — 2020-12-17
- 4.0.1 — 2020-12-15
- 3.1.4 — 2020-08-03
- 3.1.2 — 2020-07-27
- 3.1.1 — 2020-07-27
- 3.1.0 — 2020-07-24
- 3.0.3 — 2020-07-24
- 3.0.2 — 2020-07-23
- 3.0.1 — 2020-07-16
- 2.0.14 — 2020-06-09
- 2.0.13 — 2020-06-09
- 2.0.12 — 2020-05-14
- 2.0.11 — 2020-04-26
- 2.0.10 — 2020-03-19
- 2.0.9 — 2020-03-18
- … 15 more at https://npm.io/package/zax-device/versions

## README

# Zax Device

## support SSR & Miniprogram & Browser side

[![NPM version](https://img.shields.io/npm/v/zax-device.svg?style=flat)](https://www.npmjs.com/package/zax-device)
[![Build Status](https://travis-ci.org/jsonchou/zax-device.svg?branch=master)](https://travis-ci.org/jsonchou/zax-device)
[![codecov](https://codecov.io/gh/jsonchou/zax-device/branch/master/graph/badge.svg)](https://codecov.io/gh/jsonchou/zax-device)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

util module

## Browsers support

| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari-ios/safari-ios_48x48.png" alt="iOS Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>iOS Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| IE8+ Edge+                                                                                                                                                                                                      | last 10 versions                                                                                                                                                                                                  | last 10 versions                                                                                                                                                                                              | last 2 versions                                                                                                                                                                                               | last 2 versions                                                                                                                                                                                                               | last 2 versions                                                                                                                                                                                           |

## Install

```base
npm i zax-device -S
```

## usage

```javascript
import ZaxDevice,{ isWechat, isAlipay, isToutiao, isDouyin, isApp, isMiniApp, isAndroid, isIOS, isClientSide, isServerSide, isWechatMiniApp, isAlipayMiniApp, isBytedanceMiniApp, isBaiduMiniApp } from 'zax-device'
let device = new ZaxDevice({
	ua: 'CUSTOM UA OR NULL',
	appMapping: {
		dax: 'WEBVIEW_FLAG'
	}
})

// client side
// or
import { device } from 'zax-device'

device.setAppMapping('dax', 'DAX_REGEX_FLAG') //
device.setUA(ctx.reqeust.header['user-agent']) // set server ua

isWechat() //
isWechat() //
isAlipay() //
isToutiao() //
isDouyin() //
isApp() //
isApp('douyin') // same as isDouyin()
isMiniApp() //
isAndroid() //
isIOS() //
isClientSide() //
isServerSide() //
isWechatMiniApp() //
isAlipayMiniApp() //
isBytedanceMiniApp() //
isBaiduMiniApp() //

//server side
isIOS(ctx.reqeust.header['user-agent'])
```

## [Docs](https://github.com/jsonchou/zax-device/tree/master/docs)

## [Test Case](https://github.com/jsonchou/zax-device/blob/master/__tests__/index.spec.ts)

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