tscircuit/autorouting-dataset-01
This code manages the hardware and electronic components for circuit design and PCB layout, defining components like resistors, capacitors, transistors, connectors, and footprints, and providing tools for component placement, PCB topology, and electrical connections.
- Version
- 1.0.102
- License
- unset
- Stars
- 4
scripts/random-circuits/filterPinNamesForComponent.ts
import { allowedPinsByType } from "scripts/random-circuits/allowedPinsByType"
import type { ComponentType } from "types/ComponentType"
/**
* Filters footprinter pins by the component's allowed pin labels.
*/
export const filterPinNamesForComponent = (
componentType: ComponentType,
pinNames: string[],
): string[] => {
const allowedPins = allowedPinsByType[componentType]
if (!allowedPins || allowedPins.length === 0) {
return pinNames
}
const allowedSet = new Set(allowedPins)
const filtered = pinNames.filter((pin) => allowedSet.has(pin))
return filtered.length > 0 ? filtered : pinNames
}