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/normalizeFootprintForFootprinter.ts
/**
* Normalizes footprint strings for footprinter by lowercasing and removing dashes.
*/
export const normalizeFootprintForFootprinter = (footprint: string): string => {
if (typeof footprint !== "string") {
throw new Error(`Expected footprint string, got ${typeof footprint}`)
}
const normalized = footprint.trim().toLowerCase().replace(/-/g, "")
if (normalized.startsWith("pinheader")) {
return normalized.replace(/^pinheader/, "pinrow")
}
if (normalized === "sod123" || normalized === "sod323") {
return normalized
}
return normalized
}