mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Fix error on names with pluses
This commit is contained in:
parent
ebfea478fb
commit
2ac423551f
1 changed files with 7 additions and 1 deletions
|
|
@ -1,7 +1,13 @@
|
|||
function escapeRegex ( string ) {
|
||||
return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
}
|
||||
|
||||
// Match whole word
|
||||
export function matchesWholeWord (needle, haystack) {
|
||||
return new RegExp('\\b' + needle + '\\b').test(haystack)
|
||||
// console.log('haystack', haystack)
|
||||
// console.trace('needle', needle)
|
||||
|
||||
return new RegExp('\\b' + escapeRegex( needle ) + '\\b').test(haystack)
|
||||
}
|
||||
|
||||
export function fuzzyMatchesWholeWord (needle, haystack) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue