Updating the regex to correctly find within the filter keys.
This commit is contained in:
parent
28d0d627ce
commit
337584f5b2
|
@ -29,10 +29,8 @@ export function updateFilterKeys(
|
||||||
filters: SearchFilters,
|
filters: SearchFilters,
|
||||||
updates: { original: string; updated: string }[]
|
updates: { original: string; updated: string }[]
|
||||||
): SearchFilters {
|
): 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) =>
|
const makeFilterKeyRegex = (str: string) =>
|
||||||
new RegExp(`^${str}.|:${str}.`, "g")
|
new RegExp(`^${str}\\.|:${str}\\.`)
|
||||||
for (let filter of Object.values(filters)) {
|
for (let filter of Object.values(filters)) {
|
||||||
if (typeof filter !== "object") {
|
if (typeof filter !== "object") {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue