From 1898dfd1792e8dae277431a5d857921471c4b307 Mon Sep 17 00:00:00 2001 From: saqqdy Date: Mon, 12 Aug 2024 17:02:21 +0800 Subject: [PATCH] release 5.21.1 --- CHANGELOG.md | 4 ++++ README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++-- package.json | 2 +- src/osVersion.ts | 5 +++-- 4 files changed, 58 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34200e9b..60d7d742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 62a433fd..211e3f96 100644 --- a/README.md +++ b/README.md @@ -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 } @@ -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 } diff --git a/package.json b/package.json index a1c33960..f1960c80 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "js-cool", "description": "Collection of common JavaScript / TypeScript utilities", - "version": "5.21.0", + "version": "5.21.1", "packageManager": "pnpm@9.1.3", "main": "dist/index.cjs.js", "module": "dist/index.esm-bundler.js", diff --git a/src/osVersion.ts b/src/osVersion.ts index 4b50ad81..ef9ca6e7 100644 --- a/src/osVersion.ts +++ b/src/osVersion.ts @@ -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 } @@ -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