hifun-tools 1.3.28 → 1.3.29

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.
@@ -5,7 +5,7 @@ export type TenantDict = {
5
5
  tenant: string;
6
6
  };
7
7
  export declare function isIPv4(str: string): boolean;
8
- export declare function getOptimalDecodedString(encodedArray: string[]): Promise<string>;
8
+ export declare function getOptimalDecodedString(encodedArray: string[], filterIp?: boolean): Promise<string>;
9
9
  export declare function isDomainMatch(list: string[], target: string): boolean;
10
10
  export declare function toStandardUrl(input: string): string;
11
11
  export declare function matchBrowser(checkItem: string, currentBrowser: string): boolean;
@@ -13,7 +13,7 @@ export function isIPv4(str) {
13
13
  const ipv4Regex = /^(25[0-5]|2[0-4]\d|1?\d{1,2})(\.(25[0-5]|2[0-4]\d|1?\d{1,2})){3}$/;
14
14
  return ipv4Regex.test(str);
15
15
  }
16
- export async function getOptimalDecodedString(encodedArray) {
16
+ export async function getOptimalDecodedString(encodedArray, filterIp = true) {
17
17
  if (!encodedArray?.length)
18
18
  throw new Error("输入数组为空或无效");
19
19
  const hostname = window.location.hostname;
@@ -57,7 +57,11 @@ export async function getOptimalDecodedString(encodedArray) {
57
57
  }
58
58
  }, 3500);
59
59
  });
60
- return isIp ? await getOptimal(ipList) : await getOptimal(domainList);
60
+ return !filterIp
61
+ ? await getOptimal(decodedList)
62
+ : isIp
63
+ ? await getOptimal(ipList)
64
+ : await getOptimal(domainList);
61
65
  }
62
66
  /**
63
67
  * normalizeHost:保留端口,只清理协议
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hifun-tools",
3
- "version": "1.3.28",
3
+ "version": "1.3.29",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",