Skip to content

Commit

Permalink
release 5.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
saqqdy committed Aug 12, 2024
1 parent 4530a67 commit 1898dfd
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change logs

## 2024.08.12 v5.21.1

1. `osVersion` support Harmony

## 2024.08.09 v5.21.0

1. `spliceUrlParam` Breaking change: SpliceUrlParamOptions
Expand Down
52 changes: 50 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ osVersion() // \{ name: 'WindowsPhone', version: '10.0' \}

```ts
declare interface OsVersion {
name: 'Windows' | 'MacOS' | 'Android' | 'iOS' | 'WindowsPhone' | 'Debian' | 'WebOS'
name: 'Windows' | 'MacOS' | 'Android' | 'iOS' | 'WindowsPhone' | 'Debian' | 'WebOS' | 'Harmony'
version: string
}
Expand Down Expand Up @@ -1422,7 +1422,55 @@ browserVersion() // \{ name: 'Chrome', version: '114.0.0.0' \}

```ts
declare interface BrowserVersion {
name: 'Windows' | 'MacOS' | 'Android' | 'iOS' | 'WindowsPhone' | 'Debian' | 'WebOS'
name:
| 'Safari'
| 'Chrome'
| 'IE'
| 'Edge'
| 'Firefox'
| 'Firefox Focus'
| 'Chromium'
| 'Opera'
| 'Vivaldi'
| 'Yandex'
| 'Arora'
| 'Lunascape'
| 'QupZilla'
| 'Coc Coc'
| 'Kindle'
| 'Iceweasel'
| 'Konqueror'
| 'Iceape'
| 'SeaMonkey'
| 'Epiphany'
| '360'
| '360SE'
| '360EE'
| 'Maxthon'
| 'QQBrowser'
| 'QQ'
| 'Baidu'
| 'UC'
| 'Sogou'
| 'Liebao'
| 'LBBROWSER'
| '2345Explorer'
| '115Browser'
| 'TheWorld'
| 'XiaoMi'
| 'Vivo'
| 'Quark'
| 'Qiyu'
| 'Wechat'
| 'WechatWork'
| 'Taobao'
| 'Alipay'
| 'Weibo'
| 'Douban'
| 'Suning'
| 'iQiYi'
| 'DingTalk'
| 'Huawei'
version: string
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "js-cool",
"description": "Collection of common JavaScript / TypeScript utilities",
"version": "5.21.0",
"version": "5.21.1",
"packageManager": "[email protected]",
"main": "dist/index.cjs.js",
"module": "dist/index.esm-bundler.js",
Expand Down
5 changes: 3 additions & 2 deletions src/osVersion.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import inBrowser from './inBrowser'

export interface OsVersion {
name: 'Windows' | 'MacOS' | 'Android' | 'iOS' | 'WindowsPhone' | 'Debian' | 'WebOS'
name: 'Windows' | 'MacOS' | 'Android' | 'iOS' | 'WindowsPhone' | 'Debian' | 'WebOS' | 'Harmony'
version: string
}

Expand Down Expand Up @@ -50,7 +50,8 @@ function osVersion(ua?: string): OsVersion | null {
iOS: /i(?:pad|phone|pod)(?:.*)cpu(?: i(?:pad|phone|pod))? os (\d+(?:[\.|_]\d+)+) like/,
WindowsPhone: /Windows Phone(?: OS)? ([\d.]+);/,
Debian: /Debian\/([\d.]+)/,
WebOS: /hpwOS\/([\d.]+);/
WebOS: /hpwOS\/([\d.]+);/,
Harmony: /openharmony\s+([\d.]+)/
} as const

let key: keyof typeof OS_REG_MAP
Expand Down

0 comments on commit 1898dfd

Please sign in to comment.