Skip to content

Open source personal finance application

feat(getCategories): refactor

ilkomed7f8d8860f57
diff --git a/components/categories/getCategories.ts b/components/categories/getCategories.ts
index e28ce280..765359b0 100644
--- a/components/categories/getCategories.ts
+++ b/components/categories/getCategories.ts
@@ -14,11 +14,10 @@ export function getCatsIds(catsIds, catsItems) {
// TODO: add typings
export function getTransferCatgoriesIds(categoriesItems) {
- const categoriesIdsByName = Object.keys(categoriesItems)
- .filter(id =>
- categoriesItems[id].name.toLowerCase() === 'перевод'
- || categoriesItems[id].name.toLowerCase() === 'transfer',
- )
+ const names = ['перевод', 'transfer']
+ const categoriesIdsByName = Object
+ .keys(categoriesItems)
+ .filter(id => names.includes(categoriesItems[id].name.toLowerCase()))
return [...categoriesIdsByName, 'transfer']
}