mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: search case-insensitive
This commit is contained in:
parent
d84f7f07fc
commit
e2dfe89901
1 changed files with 2 additions and 1 deletions
|
|
@ -135,8 +135,9 @@ export function searchKeyToRegexps(searchKey: string) {
|
|||
if (!searchKey) return []
|
||||
|
||||
try {
|
||||
const flags = /[A-Z]/.test(searchKey) ? '' : 'i'
|
||||
// case-sensitive when searchKey contains uppercase char
|
||||
return [new RegExp(searchKey, /[A-Z]/i.test(searchKey) ? '' : 'i')]
|
||||
return [new RegExp(searchKey, flags)]
|
||||
} catch (err) {
|
||||
return [/$^/] // matching nothing if failed transforming regexp
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue