Skip to content

Commit 3e114aa

Browse files
committed
fix appversion bug
1 parent 1e3c42e commit 3e114aa

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change logs
22

3+
## 2023.07.31 v5.3.1
4+
5+
1. fix appVersion bug
6+
37
## 2023.07.18 v5.3.0
48

59
1. new `spliceUrlParam` function

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "js-cool",
33
"description": "Collection of common JavaScript / TypeScript utilities",
4-
"version": "5.3.0",
4+
"version": "5.3.1",
55
"packageManager": "pnpm@8.6.3",
66
"main": "dist/index.cjs.js",
77
"module": "dist/index.esm-bundler.js",

src/appVersion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ function appVersion(appName: string, ua?: string | boolean, ignoreCase?: boolean
3535
}
3636
if (typeof ignoreCase !== 'boolean') ignoreCase = true
3737

38-
const reg = new RegExp(`${appName}\/\\d+(.\\d)*(-\\w+.\\d+)*`, ignoreCase ? 'gi' : 'g')
38+
const reg = new RegExp(`${appName}\/(\\d+(?:.\\d)*(?:-\\w+.\\d+)*)`, ignoreCase ? 'i' : '')
3939
const match = ua.match(reg)
4040

41-
return match ? match[0] : null
41+
return match ? match[1] : null
4242
}
4343

4444
export default appVersion

0 commit comments

Comments
 (0)