Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Starman3787 committed Sep 17, 2024
1 parent dfa994a commit 5e1241c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export const validLanguages = Object.values(locales).flat();
const readObject = (obj, cursor = "") => {
if (!obj) return undefined;
const cursorPath = cursor.split(".");
for (let i = 0; i < cursorPath.length; i++) obj = obj[cursorPath[i]];
for (let i = 0; i < cursorPath.length; i++)
if (cursorPath[i]) obj = obj[cursorPath[i]];
return obj;
};

Expand All @@ -22,11 +23,11 @@ const returnNextProperty = (
ownKeys(target) {
return [
...new Set([
...(languagesStringsToUse
? Object.keys(languagesStringsToUse)
...(readObject(languagesStringsToUse, cursor)
? Object.keys(readObject(languagesStringsToUse, cursor))
: []),
...(fallbackLanguagesStrings
? Object.keys(fallbackLanguagesStrings)
...(readObject(fallbackLanguagesStrings, cursor)
? Object.keys(readObject(fallbackLanguagesStrings, cursor))
: []),
]),
];
Expand Down

0 comments on commit 5e1241c

Please sign in to comment.