Skip to content

Commit

Permalink
Sort pin labels (#93)
Browse files Browse the repository at this point in the history
* Sort pin labels

* Format
  • Loading branch information
andrii-balitskyi authored Oct 31, 2024
1 parent 0e82664 commit d0049d6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/convert-to-typescript-component/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ export const convertBetterEasyToTsx = async ({
const sourcePorts = su(circuitJson).source_port.list()

const pinLabels: Record<string, string[]> = {}
for (const sourcePort of sourcePorts) {
const sortedPorts = sourcePorts.sort((a, b) => {
const aNum = parseInt(a.name.replace("pin", ""))
const bNum = parseInt(b.name.replace("pin", ""))
return aNum - bNum
})
for (const sourcePort of sortedPorts) {
pinLabels[sourcePort.name] = [
sourcePort.name,
...(sourcePort.port_hints ?? []),
Expand Down

0 comments on commit d0049d6

Please sign in to comment.