easyeda 0.0.58 → 0.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2476,27 +2476,40 @@ var convertBetterEasyToTsx = async ({
2476
2476
  const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
2477
2477
  const pn = normalizeManufacturerPartNumber(rawPn);
2478
2478
  const [cad_component2] = su_default(circuitJson).cad_component.list();
2479
- const pinLabels = {};
2480
- for (const shape of betterEasy.dataStr.shape) {
2481
- if (shape.type === "PIN") {
2482
- const isPinLabelNumeric = /^\d+$/.test(shape.label);
2483
- const label = isPinLabelNumeric ? `pin${shape.label}` : shape.label;
2484
- pinLabels[shape.pinNumber.toString()] = label;
2485
- }
2486
- }
2487
2479
  const pins = betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN");
2488
- const leftPins = pins.filter((pin) => pin.rotation === 180);
2489
- const rightPins = pins.filter((pin) => pin.rotation === 0);
2480
+ const hasStringPinNumbers = pins.some(
2481
+ (pin) => typeof pin.pinNumber === "string"
2482
+ );
2483
+ let modifiedPins = pins;
2484
+ if (hasStringPinNumbers) {
2485
+ modifiedPins = pins.map((pin, idx) => {
2486
+ const originalPinNumber = pin.pinNumber.toString();
2487
+ const newPinNumber = idx + 1;
2488
+ return {
2489
+ ...pin,
2490
+ pinNumber: newPinNumber,
2491
+ label: pin.label
2492
+ };
2493
+ });
2494
+ }
2495
+ const leftPins = modifiedPins.filter((pin) => pin.rotation === 180);
2496
+ const rightPins = modifiedPins.filter((pin) => pin.rotation === 0);
2490
2497
  const schPinArrangement = {
2491
2498
  leftSide: {
2492
2499
  direction: "top-to-bottom",
2493
- pins: leftPins.map((pin) => pin.pinNumber)
2500
+ pins: leftPins.map((pin) => Number(pin.pinNumber))
2494
2501
  },
2495
2502
  rightSide: {
2496
2503
  direction: "bottom-to-top",
2497
- pins: rightPins.map((pin) => pin.pinNumber).reverse()
2504
+ pins: rightPins.map((pin) => Number(pin.pinNumber)).reverse()
2498
2505
  }
2499
2506
  };
2507
+ const pinLabels = {};
2508
+ for (const pin of modifiedPins) {
2509
+ const isPinLabelNumeric = /^\d+$/.test(pin.label);
2510
+ const label = isPinLabelNumeric ? `pin${pin.label}` : pin.label;
2511
+ pinLabels[pin.pinNumber] = label;
2512
+ }
2500
2513
  let modelObjUrl;
2501
2514
  if (cad_component2.model_obj_url) {
2502
2515
  const isValidUrl = await checkModelObjUrlValidity(
@@ -2619,4 +2632,4 @@ export {
2619
2632
  convertRawEasyToTsx,
2620
2633
  convertEasyEdaJsonToVariousFormats
2621
2634
  };
2622
- //# sourceMappingURL=chunk-CVJME4JW.js.map
2635
+ //# sourceMappingURL=chunk-X4DC7FIK.js.map