https://github.com/willin/uua
Unbelievable User-Agent Module for both Node.js and Browser
https://github.com/willin/uua
Last synced: 2 months ago
JSON representation
Unbelievable User-Agent Module for both Node.js and Browser
- Host: GitHub
- URL: https://github.com/willin/uua
- Owner: willin
- License: apache-2.0
- Created: 2020-08-09T14:08:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-17T01:38:37.000Z (almost 6 years ago)
- Last Synced: 2025-12-25T23:31:34.114Z (6 months ago)
- Language: TypeScript
- Size: 310 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# uua - Unbelievable UserAgent
## Usage
### Core
```js
import uua from '@uua/core';
// Pass in UserAgent string
// const ua = navigator.userAgent;
// const ua = ctx.request.headers['user-agent'];
uua(ua);
```
Result Structure:
```js
{
"browser": {
"title": "Safari",
"version": "6.0",
"code": "safari",
"icon": "/device/safari.png"
},
// or undefined
"device": {
"title": "iPod",
"version": "iOS 6.0.1",
"code": "iphone",
"icon": "/net/iphone.png"
},
"os": {
"title": "Mac",
"version": "",
"code": "mac-3",
"icon": "/os/mac-3.png"
}
}
```
### Icons & CDN
You may fork `@uua/icons` (Source: ) and make your own icon design.
By default, `uua` is using [jsdelivr](https://www.jsdelivr.com/package/npm/@uua/icons) CDN
### ip2c
```js
import ip2c from '@uua/ip2c';
// in async function
await ip2c();
```
Result Structure:
```js
{
"code": "CN",
"country": "China",
"icon": "/flag/cn.png"
}
```
## Packages
- `uua` (Please use `@uua/core` instead)
- `@uua/core`: Core Lib
- `@uua/icons`: Image Materials ()
## LICENSE
Apache-2.0
