From 78ebcb15d5b7cb59e5ce5a7f4b5382809046f537 Mon Sep 17 00:00:00 2001 From: xingyu <xingyu4j@vip.qq.com> Date: Tue, 7 Nov 2023 09:18:55 +0800 Subject: [PATCH] fix: utils --- src/utils/index.ts | 8 +++++--- src/utils/is.ts | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index 31b2f937..421d5db5 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,6 +1,5 @@ import type { RouteLocationNormalized, RouteRecordNormalized } from 'vue-router' import type { App, Component } from 'vue' - import { intersectionWith, isEqual, mergeWith, unionWith } from 'lodash-es' import { unref } from 'vue' import { isArray, isObject } from '@/utils/is' @@ -80,7 +79,10 @@ export function deepMerge<T extends object | null | undefined, U extends object }) } -export function openWindow(url: string, opt?: { target?: TargetContext | string; noopener?: boolean; noreferrer?: boolean }) { +export function openWindow( + url: string, + opt?: { target?: TargetContext | string; noopener?: boolean; noreferrer?: boolean }, +) { const { target = '__blank', noopener = true, noreferrer = true } = opt || {} const feature: string[] = [] @@ -134,7 +136,7 @@ export type WithInstall<T> = T & { export type CustomComponent = Component & { displayName?: string } export function withInstall<T extends CustomComponent>(component: T, alias?: string) { - ;(component as Record<string, unknown>).install = (app: App) => { + (component as Record<string, unknown>).install = (app: App) => { const compName = component.name || component.displayName if (!compName) return diff --git a/src/utils/is.ts b/src/utils/is.ts index c3147e67..15946c7b 100644 --- a/src/utils/is.ts +++ b/src/utils/is.ts @@ -66,7 +66,7 @@ export function isString(val: unknown): val is string { return is(val, 'String') } -export function isFunction(val: unknown): val is Fn { +export function isFunction(val: unknown): val is Function { return typeof val === 'function' } @@ -99,6 +99,6 @@ export const isServer = typeof window === 'undefined' export const isClient = !isServer export function isUrl(path: string): boolean { - const reg = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/ + const reg = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/ return reg.test(path) }