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