Refactor: drop Bun.peek usage as much as possible

This commit is contained in:
SukkaW
2024-07-23 14:04:05 +08:00
parent 93fc073a22
commit b947f9f818
3 changed files with 7 additions and 13 deletions

View File

@@ -6,11 +6,7 @@ import { getChnCidrPromise } from './build-chn-cidr';
import { NON_CN_CIDR_INCLUDED_IN_CHNROUTE, RESERVED_IPV4_CIDR } from './constants/cidr';
export const buildInternalReverseChnCIDR = task(import.meta.main, import.meta.path)(async () => {
const cidrPromise = getChnCidrPromise();
const peeked = Bun.peek(cidrPromise);
const cidr: string[] = peeked === cidrPromise
? await cidrPromise
: (peeked as string[]);
const cidr = await getChnCidrPromise();
const reversedCidr = merge(
exclude(