Skip to content

Commit

Permalink
refactor: adjust node value name
Browse files Browse the repository at this point in the history
  • Loading branch information
luckasnix committed May 18, 2024
1 parent 8704430 commit 3f4a94f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/object-graph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
if (typeof nodeKey !== "string") {
throw new TypeError('The parameter "nodeKey" must be a string');
}
const node = this.nodes.get(nodeKey);
if (!node) {
const nodeValue = this.nodes.get(nodeKey);
if (!nodeValue) {
throw new Error(
"A node with this key does not exist in the object graph",
);
}
return node;
return nodeValue;
}

/**
Expand Down

0 comments on commit 3f4a94f

Please sign in to comment.