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/browser/index.js
CHANGED
|
@@ -12151,9 +12151,24 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber, {
|
|
|
12151
12151
|
if (!searchResult.success || !searchResult.result.lists.lcsc.length) {
|
|
12152
12152
|
throw new Error("Component not found");
|
|
12153
12153
|
}
|
|
12154
|
+
const requestedPartNumber = jlcpcbPartNumber.trim().toUpperCase();
|
|
12154
12155
|
const bestMatchComponent = searchResult.result.lists.lcsc.find(
|
|
12155
|
-
(component) =>
|
|
12156
|
-
|
|
12156
|
+
(component) => {
|
|
12157
|
+
const candidatePartNumbers = [
|
|
12158
|
+
component.dataStr?.head?.c_para?.["Supplier Part"],
|
|
12159
|
+
component.lcsc?.number,
|
|
12160
|
+
component.szlcsc?.number
|
|
12161
|
+
];
|
|
12162
|
+
return candidatePartNumbers.some(
|
|
12163
|
+
(partNumber) => typeof partNumber === "string" && partNumber.trim().toUpperCase() === requestedPartNumber
|
|
12164
|
+
);
|
|
12165
|
+
}
|
|
12166
|
+
);
|
|
12167
|
+
if (!bestMatchComponent) {
|
|
12168
|
+
throw new Error(
|
|
12169
|
+
`No exact EasyEDA component match for "${jlcpcbPartNumber}"`
|
|
12170
|
+
);
|
|
12171
|
+
}
|
|
12157
12172
|
const componentUUID = bestMatchComponent.uuid;
|
|
12158
12173
|
const componentResponse = await fetch2(componentUrl(componentUUID), {
|
|
12159
12174
|
method: "GET",
|