diff --git a/src/lib/extension/CustomCategoriesResolver.ts b/src/lib/extension/CustomCategoriesResolver.ts index 11e9935..4a2545b 100644 --- a/src/lib/extension/CustomCategoriesResolver.ts +++ b/src/lib/extension/CustomCategoriesResolver.ts @@ -1,6 +1,6 @@ import type { TagDropdownWrapper } from "$lib/components/TagDropdownWrapper"; import TagGroup from "$entities/TagGroup"; -import { escapeRegExp } from "$lib/utils"; +import { escape as escapeRegExp } from "@std/regexp"; import { emit } from "$lib/components/events/comms"; import { EVENT_TAG_GROUP_RESOLVED } from "$lib/components/events/tag-dropdown-events"; diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 251fd43..e743865 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -21,21 +21,3 @@ export function findDeepObject(targetObject: Record, path: string[] return result; } - -/** - * Matches all the characters needing replacement. - * - * Gathered from right here: https://stackoverflow.com/a/3561711/16048617. Because I don't want to introduce some - * library for that. - */ -const unsafeRegExpCharacters: RegExp = /[/\-\\^$*+?.()|[\]{}]/g; - -/** - * Escape all the RegExp syntax-related characters in the following value. - * @param value Original value. - * @return Resulting value with all needed characters escaped. - */ -export function escapeRegExp(value: string): string { - unsafeRegExpCharacters.lastIndex = 0; - return value.replace(unsafeRegExpCharacters, "\\$&"); -}