1
0
Fork 0
mirror of synced 2024-07-12 17:56:07 +12:00

Updating the regex to correctly find within the filter keys.

This commit is contained in:
mike12345567 2024-06-21 17:51:02 +01:00
parent 28d0d627ce
commit 337584f5b2

View file

@ -29,10 +29,8 @@ export function updateFilterKeys(
filters: SearchFilters,
updates: { original: string; updated: string }[]
): SearchFilters {
// sort the updates by length first - this is necessary to avoid replacing sub-strings
updates = updates.sort((a, b) => b.original.length - a.original.length)
const makeFilterKeyRegex = (str: string) =>
new RegExp(`^${str}.|:${str}.`, "g")
new RegExp(`^${str}\\.|:${str}\\.`)
for (let filter of Object.values(filters)) {
if (typeof filter !== "object") {
continue