Find whether a port is occupied?

How can i know if a port in GraphLinksmodel is occupied or not.

in the example http://gojs.net/latest/samples/flowchart.html , lets say I want to know whether a link is using port “B” of node with key “1”.

var node = myDiagram.findNodeForKey("1");
if (node !== null) {
    var links = node.findLinksConnected("B");
    if (links.count > 0) {
        ...
    }
}

thanks this worked :smile: