Skip to content

Commit

Permalink
Merge pull request #94 from JesusTheHun/fix-getEdgeProperties
Browse files Browse the repository at this point in the history
fix: `getEdgeProperties` may return `undefined` if the edge doesn't exists
  • Loading branch information
curran authored Oct 23, 2024
2 parents d9785de + b071242 commit 3f8fb2c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ export class Graph<Node = string, LinkProps = never> {
}

/**
* Get the properties of the given edge or undefined if none are set.
* Get the properties of the given edge or undefined if the edge doesn't exist .
*/
getEdgeProperties(source: Node, target: Node): LinkProps {
return this.edgeProperties.get(source)?.get(target) as LinkProps;
getEdgeProperties(source: Node, target: Node): LinkProps | undefined {
return this.edgeProperties.get(source)?.get(target);
}

/**
Expand Down

0 comments on commit 3f8fb2c

Please sign in to comment.