Skip to content

Commit

Permalink
fix: 🐛 Don't index an array using Object.keys 😋
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Nov 19, 2021
1 parent 2147518 commit 79dd8b1
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/sharedFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,6 @@ export async function getNeighbourObjArr(
};

userHierarchies.forEach((hier) => {
const fieldsArr = Object.values(hier) as [
string[],
string[],
string[],
string[],
string[]
];
const newHier: HierarchyFields = {
up: {},
same: {},
Expand All @@ -382,15 +375,15 @@ export async function getNeighbourObjArr(

// Add regular metadata links
if (settings.useAllMetadata) {
DIRECTIONS.forEach((dir, i) => {
fieldsArr[i]?.forEach((field) => {
for (const dir of DIRECTIONS) {
hier[dir].forEach((field) => {
newHier[dir][field] = getFieldValues(
fileFrontmatter,
field,
settings
);
});
});
}
}

// Add Juggl Links
Expand Down Expand Up @@ -787,6 +780,8 @@ export function addEdgeIfNot(
target: string,
attr?: NodeAttributes
) {
addNodeIfNot(g, source);
addNodeIfNot(g, target);
if (!g.hasEdge(source, target)) g.addEdge(source, target, attr);
}

Expand Down

0 comments on commit 79dd8b1

Please sign in to comment.