diff --git a/src/helpers/stringHelpers.ts b/src/helpers/stringHelpers.ts index 18a3bd6e..75b42136 100644 --- a/src/helpers/stringHelpers.ts +++ b/src/helpers/stringHelpers.ts @@ -16,3 +16,11 @@ export const getSubstringFromKeywordToKeyword = (str: string, keywordBegin: stri const endIndex = str.indexOf(keywordEnd); return str.substring(beginIndex, endIndex + 1); }; + +export const getIndexAfter = (str: string, searchWord: string) => { + const index = str.indexOf(searchWord); + if (index === -1) { + return -1; + } + return index + searchWord.length; +}; diff --git a/src/services/itemDataService.ts b/src/services/itemDataService.ts index f0c3eddc..a251b9ae 100644 --- a/src/services/itemDataService.ts +++ b/src/services/itemDataService.ts @@ -1,3 +1,4 @@ +import { getIndexAfter } from "@/src/helpers/stringHelpers"; import { logger } from "@/src/utils/logger"; import Items, { Buildable, Category, Item, Warframe, Weapon } from "warframe-items"; @@ -105,14 +106,6 @@ export const getItemCategoryByUniqueName = (uniqueName: string) => { return category; }; -export const getIndexAfter = (str: string, searchWord: string) => { - const index = str.indexOf(searchWord); - if (index === -1) { - return -1; - } - return index + searchWord.length; -}; - export const getItemByUniqueName = (uniqueName: string) => { const item = items.find(item => item.uniqueName === uniqueName); return item;