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