@whitesev/utils 2.11.12 → 2.11.14

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