MCPcopy Create free account
hub / github.com/openscopeproject/InteractiveHtmlBom / compareRefs

Function compareRefs

InteractiveHtmlBom/web/ibom.js:556–571  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

554 }
555 var referenceRegex = /(?<prefix>[^0-9]+)(?<number>[0-9]+)/;
556 var compareRefs = (a, b) => {
557 var ra = referenceRegex.exec(a);
558 var rb = referenceRegex.exec(b);
559 if (ra === null || rb === null) {
560 if (a != b) return a > b ? 1 : -1;
561 return 0;
562 } else {
563 if (ra.groups.prefix != rb.groups.prefix) {
564 return ra.groups.prefix > rb.groups.prefix ? 1 : -1;
565 }
566 if (ra.groups.number != rb.groups.number) {
567 return parseInt(ra.groups.number) > parseInt(rb.groups.number) ? 1 : -1;
568 }
569 return 0;
570 }
571 }
572 if (settings.bommode == "netlist") {
573 tr.appendChild(createColumnHeader("Net name", "bom-netname", (a, b) => {
574 if (a > b) return -1;

Callers 1

populateBomHeaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected