@whitesev/utils 2.9.5 → 2.9.6

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.cjs.js CHANGED
@@ -79,6 +79,9 @@ class ColorConversion {
79
79
  if (typeof level !== "number") {
80
80
  level = Number(level);
81
81
  }
82
+ if (isNaN(level)) {
83
+ throw new TypeError(`输入错误的level:${level}`);
84
+ }
82
85
  const rgbc = this.hexToRgb(color);
83
86
  for (let index = 0; index < 3; index++) {
84
87
  const rgbcItemValue = rgbc[index];
@@ -99,6 +102,9 @@ class ColorConversion {
99
102
  if (typeof level !== "number") {
100
103
  level = Number(level);
101
104
  }
105
+ if (isNaN(level)) {
106
+ throw new TypeError(`输入错误的level:${level}`);
107
+ }
102
108
  const rgbc = this.hexToRgb(color);
103
109
  for (let index = 0; index < 3; index++) {
104
110
  const rgbcItemValue = Number(rgbc[index]);
@@ -582,7 +588,7 @@ class UtilsGMCookie {
582
588
  }
583
589
  }
584
590
  /**
585
- * 获取多组Cookie
591
+ * 获取多组Cookie
586
592
  * @param option 配置
587
593
  **/
588
594
  getList(option) {
@@ -695,7 +701,8 @@ class UtilsGMCookie {
695
701
  }
696
702
  }
697
703
  /**
698
- * 解析cookie字符串
704
+ * 解析cookie字符串,按`;`分割
705
+ *
699
706
  * 例如:document.cookie
700
707
  * @param cookieStr
701
708
  */
@@ -2112,31 +2119,31 @@ class GMMenu {
2112
2119
  }
2113
2120
  /**
2114
2121
  * 设置当enable为true时默认显示在菜单中前面的emoji图标
2115
- * @param emojiString
2122
+ * @param emojiString emoji字符串
2116
2123
  */
2117
2124
  setEnableTrueEmoji(emojiString) {
2118
2125
  if (typeof emojiString !== "string") {
2119
- throw new Error("参数emojiString必须是string类型");
2126
+ throw new TypeError("参数emojiString必须是string类型");
2120
2127
  }
2121
2128
  this.MenuHandle.$emoji.success = emojiString;
2122
2129
  }
2123
2130
  /**
2124
2131
  * 设置当enable为false时默认显示在菜单中前面的emoji图标
2125
- * @param emojiString
2132
+ * @param emojiString emoji字符串
2126
2133
  */
2127
2134
  setEnableFalseEmoji(emojiString) {
2128
2135
  if (typeof emojiString !== "string") {
2129
- throw new Error("参数emojiString必须是string类型");
2136
+ throw new TypeError("参数emojiString必须是string类型");
2130
2137
  }
2131
2138
  this.MenuHandle.$emoji.error = emojiString;
2132
2139
  }
2133
2140
  /**
2134
2141
  * 设置本地存储的菜单外部的键名
2135
- * @param keyName
2142
+ * @param keyName 键名
2136
2143
  */
2137
2144
  setLocalStorageKeyName(keyName) {
2138
2145
  if (typeof keyName !== "string") {
2139
- throw new Error("参数keyName必须是string类型");
2146
+ throw new TypeError("参数keyName必须是string类型");
2140
2147
  }
2141
2148
  this.MenuHandle.$data.key = keyName;
2142
2149
  }
@@ -5485,7 +5492,7 @@ class DOMUtils {
5485
5492
  }
5486
5493
  const domUtils = new DOMUtils();
5487
5494
 
5488
- const version = "2.9.5";
5495
+ const version = "2.9.6";
5489
5496
 
5490
5497
  class Utils {
5491
5498
  windowApi;