easyeda 0.0.363 → 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.
@@ -13645,34 +13645,39 @@ var isResistorComponent = (betterEasy) => {
13645
13645
  };
13646
13646
 
13647
13647
  // lib/websafe/convert-to-typescript-component/category-value-contains-switch.ts
13648
- var categoryValueContainsSwitch = (value) => {
13649
- if (typeof value === "string") {
13650
- const normalized = value.toLowerCase();
13651
- if (/analog\s+switch/.test(normalized) || /multiplex/.test(normalized) || /switching\s+diodes?/.test(normalized) || /\bics?\b/.test(normalized)) {
13652
- return false;
13653
- }
13654
- return /(?:slide|toggle|dip|key|micro|limit)\s+switch(?:es)?/.test(normalized) || /(^|[^a-z])switch(?:es)?([^a-z]|$)/.test(normalized);
13655
- }
13656
- if (Array.isArray(value)) {
13657
- return value.some(categoryValueContainsSwitch);
13658
- }
13659
- if (value && typeof value === "object") {
13660
- return Object.values(value).some(categoryValueContainsSwitch);
13648
+ var getCategoryStrings = (category) => {
13649
+ if (typeof category === "string") return [category.toLowerCase()];
13650
+ if (Array.isArray(category)) return category.flatMap(getCategoryStrings);
13651
+ if (category && typeof category === "object") {
13652
+ return Object.values(category).flatMap(getCategoryStrings);
13653
+ }
13654
+ return [];
13655
+ };
13656
+ var categoryValueContainsSwitch = (category) => {
13657
+ const categoryStrings = getCategoryStrings(category);
13658
+ if (categoryStrings.some(
13659
+ (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(
13660
+ category2
13661
+ )
13662
+ )) {
13663
+ return false;
13661
13664
  }
13662
- return false;
13665
+ return categoryStrings.some(
13666
+ (category2) => /(?:slide|toggle|dip|key|micro|limit)\s+switch(?:es)?/.test(category2) || /(^|[^a-z])switch(?:es)?([^a-z]|$)/.test(category2)
13667
+ );
13663
13668
  };
13664
13669
 
13665
13670
  // lib/websafe/convert-to-typescript-component/is-switch-category-component.ts
13666
13671
  var isSwitchCategoryComponent = (betterEasy) => {
13667
13672
  const cPara = betterEasy.dataStr.head.c_para;
13668
- return [
13673
+ return categoryValueContainsSwitch([
13669
13674
  betterEasy.tags,
13670
13675
  cPara.category,
13671
13676
  cPara.Category,
13672
13677
  cPara["LCSC Category"],
13673
13678
  cPara["JLCPCB Category"],
13674
13679
  betterEasy.category
13675
- ].some(categoryValueContainsSwitch);
13680
+ ]);
13676
13681
  };
13677
13682
 
13678
13683
  // lib/websafe/convert-to-typescript-component/index.tsx