@whitesev/utils 2.11.12 → 2.11.13

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.
@@ -240,7 +240,7 @@ var Utils = (function () {
240
240
  const setInterval$1 = (...args) => loadOrReturnBroker().setInterval(...args);
241
241
  const setTimeout$1 = (...args) => loadOrReturnBroker().setTimeout(...args);
242
242
 
243
- const version = "2.11.12";
243
+ const version = "2.11.13";
244
244
 
245
245
  /* eslint-disable */
246
246
  // ==UserScript==
@@ -1921,13 +1921,25 @@ var Utils = (function () {
1921
1921
  }
1922
1922
  /**
1923
1923
  * 迭代字典
1924
- * @param callbackfn 回调函数
1924
+ * @param cb 回调函数
1925
1925
  */
1926
- forEach(callbackfn) {
1926
+ forEach(cb) {
1927
1927
  this.items.forEach((value, key) => {
1928
- callbackfn(value, key, this);
1928
+ cb(value, key, this);
1929
1929
  });
1930
1930
  }
1931
+ /**
1932
+ * 找到字典中对应的键和值
1933
+ * @param cb 回调函数
1934
+ */
1935
+ find(cb) {
1936
+ for (const [key, value] of this.items.entries()) {
1937
+ const result = cb(value, key, this);
1938
+ if (result) {
1939
+ return result;
1940
+ }
1941
+ }
1942
+ }
1931
1943
  /**
1932
1944
  * 检查已有的键中是否以xx开头
1933
1945
  * @param key 需要匹配的键