easyeda 0.0.281 → 0.0.283
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.
- package/dist/browser/index.js +17 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +18 -3
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -3454,9 +3454,24 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber, {
|
|
|
3454
3454
|
if (!searchResult.success || !searchResult.result.lists.lcsc.length) {
|
|
3455
3455
|
throw new Error("Component not found");
|
|
3456
3456
|
}
|
|
3457
|
+
const requestedPartNumber = jlcpcbPartNumber.trim().toUpperCase();
|
|
3457
3458
|
const bestMatchComponent = searchResult.result.lists.lcsc.find(
|
|
3458
|
-
(component) =>
|
|
3459
|
-
|
|
3459
|
+
(component) => {
|
|
3460
|
+
const candidatePartNumbers = [
|
|
3461
|
+
component.dataStr?.head?.c_para?.["Supplier Part"],
|
|
3462
|
+
component.lcsc?.number,
|
|
3463
|
+
component.szlcsc?.number
|
|
3464
|
+
];
|
|
3465
|
+
return candidatePartNumbers.some(
|
|
3466
|
+
(partNumber) => typeof partNumber === "string" && partNumber.trim().toUpperCase() === requestedPartNumber
|
|
3467
|
+
);
|
|
3468
|
+
}
|
|
3469
|
+
);
|
|
3470
|
+
if (!bestMatchComponent) {
|
|
3471
|
+
throw new Error(
|
|
3472
|
+
`No exact EasyEDA component match for "${jlcpcbPartNumber}"`
|
|
3473
|
+
);
|
|
3474
|
+
}
|
|
3460
3475
|
const componentUUID = bestMatchComponent.uuid;
|
|
3461
3476
|
const componentResponse = await fetch2(componentUrl(componentUUID), {
|
|
3462
3477
|
method: "GET",
|
|
@@ -3513,7 +3528,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
|
|
|
3513
3528
|
var package_default = {
|
|
3514
3529
|
name: "easyeda",
|
|
3515
3530
|
type: "module",
|
|
3516
|
-
version: "0.0.
|
|
3531
|
+
version: "0.0.282",
|
|
3517
3532
|
files: [
|
|
3518
3533
|
"dist"
|
|
3519
3534
|
],
|