Skip to content

Commit

Permalink
extract findNodeEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Aug 16, 2023
1 parent 783e91f commit 930850f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/lang/net/findNodeEntry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Node } from "../node"
import { nodeKeyId } from "../node/nodeKeyId"
import { Net, NodeEntry } from "./Net"

export function findNodeEntry(net: Net, node: Node): NodeEntry | undefined {
return net.nodeEntries.get(nodeKeyId(node))
}
4 changes: 2 additions & 2 deletions src/lang/net/findPortRecord.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Node } from "../node"
import { nodeKeyId } from "../node/nodeKeyId"
import { Net, PortRecord } from "./Net"
import { findNodeEntry } from "./findNodeEntry"

export function findPortRecord(net: Net, node: Node): PortRecord | undefined {
const nodeEntry = net.nodeEntries.get(nodeKeyId(node))
const nodeEntry = findNodeEntry(net, node)
return nodeEntry?.ports
}

0 comments on commit 930850f

Please sign in to comment.