easyeda 0.0.362 → 0.0.364

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/main.cjs CHANGED
@@ -1078,7 +1078,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
1078
1078
  var package_default = {
1079
1079
  name: "easyeda",
1080
1080
  type: "module",
1081
- version: "0.0.361",
1081
+ version: "0.0.363",
1082
1082
  files: [
1083
1083
  "dist"
1084
1084
  ],
@@ -10923,34 +10923,39 @@ var isResistorComponent = (betterEasy) => {
10923
10923
  };
10924
10924
 
10925
10925
  // lib/websafe/convert-to-typescript-component/category-value-contains-switch.ts
10926
- var categoryValueContainsSwitch = (value) => {
10927
- if (typeof value === "string") {
10928
- const normalized = value.toLowerCase();
10929
- if (/analog\s+switch/.test(normalized) || /multiplex/.test(normalized) || /switching\s+diodes?/.test(normalized) || /\bics?\b/.test(normalized)) {
10930
- return false;
10931
- }
10932
- return /(?:slide|toggle|dip|key|micro|limit)\s+switch(?:es)?/.test(normalized) || /(^|[^a-z])switch(?:es)?([^a-z]|$)/.test(normalized);
10933
- }
10934
- if (Array.isArray(value)) {
10935
- return value.some(categoryValueContainsSwitch);
10936
- }
10937
- if (value && typeof value === "object") {
10938
- return Object.values(value).some(categoryValueContainsSwitch);
10926
+ var getCategoryStrings = (category) => {
10927
+ if (typeof category === "string") return [category.toLowerCase()];
10928
+ if (Array.isArray(category)) return category.flatMap(getCategoryStrings);
10929
+ if (category && typeof category === "object") {
10930
+ return Object.values(category).flatMap(getCategoryStrings);
10931
+ }
10932
+ return [];
10933
+ };
10934
+ var categoryValueContainsSwitch = (category) => {
10935
+ const categoryStrings = getCategoryStrings(category);
10936
+ if (categoryStrings.some(
10937
+ (category2) => /analog[\s-]+switch/.test(category2) || /multiplex/.test(category2) || /switching\s+diodes?/.test(category2) || /\bics?\b/.test(category2) || /\b(?:power[\s-]+distribution|load)[\s-]+switch(?:es)?\b/.test(
10938
+ category2
10939
+ )
10940
+ )) {
10941
+ return false;
10939
10942
  }
10940
- return false;
10943
+ return categoryStrings.some(
10944
+ (category2) => /(?:slide|toggle|dip|key|micro|limit)\s+switch(?:es)?/.test(category2) || /(^|[^a-z])switch(?:es)?([^a-z]|$)/.test(category2)
10945
+ );
10941
10946
  };
10942
10947
 
10943
10948
  // lib/websafe/convert-to-typescript-component/is-switch-category-component.ts
10944
10949
  var isSwitchCategoryComponent = (betterEasy) => {
10945
10950
  const cPara = betterEasy.dataStr.head.c_para;
10946
- return [
10951
+ return categoryValueContainsSwitch([
10947
10952
  betterEasy.tags,
10948
10953
  cPara.category,
10949
10954
  cPara.Category,
10950
10955
  cPara["LCSC Category"],
10951
10956
  cPara["JLCPCB Category"],
10952
10957
  betterEasy.category
10953
- ].some(categoryValueContainsSwitch);
10958
+ ]);
10954
10959
  };
10955
10960
 
10956
10961
  // lib/websafe/convert-to-typescript-component/index.tsx