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.
package/dist/index.js CHANGED
@@ -10018,34 +10018,39 @@ var isResistorComponent = (betterEasy) => {
10018
10018
  };
10019
10019
 
10020
10020
  // lib/websafe/convert-to-typescript-component/category-value-contains-switch.ts
10021
- var categoryValueContainsSwitch = (value) => {
10022
- if (typeof value === "string") {
10023
- const normalized = value.toLowerCase();
10024
- if (/analog\s+switch/.test(normalized) || /multiplex/.test(normalized) || /switching\s+diodes?/.test(normalized) || /\bics?\b/.test(normalized)) {
10025
- return false;
10026
- }
10027
- return /(?:slide|toggle|dip|key|micro|limit)\s+switch(?:es)?/.test(normalized) || /(^|[^a-z])switch(?:es)?([^a-z]|$)/.test(normalized);
10028
- }
10029
- if (Array.isArray(value)) {
10030
- return value.some(categoryValueContainsSwitch);
10031
- }
10032
- if (value && typeof value === "object") {
10033
- return Object.values(value).some(categoryValueContainsSwitch);
10021
+ var getCategoryStrings = (category) => {
10022
+ if (typeof category === "string") return [category.toLowerCase()];
10023
+ if (Array.isArray(category)) return category.flatMap(getCategoryStrings);
10024
+ if (category && typeof category === "object") {
10025
+ return Object.values(category).flatMap(getCategoryStrings);
10026
+ }
10027
+ return [];
10028
+ };
10029
+ var categoryValueContainsSwitch = (category) => {
10030
+ const categoryStrings = getCategoryStrings(category);
10031
+ if (categoryStrings.some(
10032
+ (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(
10033
+ category2
10034
+ )
10035
+ )) {
10036
+ return false;
10034
10037
  }
10035
- return false;
10038
+ return categoryStrings.some(
10039
+ (category2) => /(?:slide|toggle|dip|key|micro|limit)\s+switch(?:es)?/.test(category2) || /(^|[^a-z])switch(?:es)?([^a-z]|$)/.test(category2)
10040
+ );
10036
10041
  };
10037
10042
 
10038
10043
  // lib/websafe/convert-to-typescript-component/is-switch-category-component.ts
10039
10044
  var isSwitchCategoryComponent = (betterEasy) => {
10040
10045
  const cPara = betterEasy.dataStr.head.c_para;
10041
- return [
10046
+ return categoryValueContainsSwitch([
10042
10047
  betterEasy.tags,
10043
10048
  cPara.category,
10044
10049
  cPara.Category,
10045
10050
  cPara["LCSC Category"],
10046
10051
  cPara["JLCPCB Category"],
10047
10052
  betterEasy.category
10048
- ].some(categoryValueContainsSwitch);
10053
+ ]);
10049
10054
  };
10050
10055
 
10051
10056
  // lib/websafe/convert-to-typescript-component/index.tsx