Skip to content

Commit

Permalink
feat(添加缺失的 checkStrIsUuid):
Browse files Browse the repository at this point in the history
  • Loading branch information
qixing-jk committed Jan 20, 2025
1 parent 3310a60 commit 1e21f9d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ export function checkStartWithHttp(str) {
}
}

// 检查一个字符串是否UUID https://ihateregex.io/expr/uuid/
export function checkStrIsUuid(str) {
if (!str) {
return false
}
// 使用正则表达式进行匹配
const regex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/
return regex.test(str)
}


// 检查一个字符串是否notionid : 32位,仅由数字英文构成
export function checkStrIsNotionId(str) {
if (!str) {
Expand Down

0 comments on commit 1e21f9d

Please sign in to comment.