From dda60bd200c17acf97f0397149167bccd181d558 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Sun, 12 Dec 2021 23:44:29 -0600 Subject: [PATCH] chore(utils): remove unnecessary as string (#4805) --- packages/utils/validators.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/utils/validators.ts b/packages/utils/validators.ts index e4b6d2e3bf..ea0f4dc4f1 100644 --- a/packages/utils/validators.ts +++ b/packages/utils/validators.ts @@ -3,13 +3,12 @@ import { isNumber } from './util' export const isValidWidthUnit = (val: string | number): boolean => { if (isNumber(val)) { return true - } else { - return ( - ['px', 'rem', 'em', 'vw', '%', 'vmin', 'vmax'].some((unit) => - (val as string).endsWith(unit) - ) || (val as string).startsWith('calc') - ) } + return ( + ['px', 'rem', 'em', 'vw', '%', 'vmin', 'vmax'].some((unit) => + val.endsWith(unit) + ) || val.startsWith('calc') + ) } export const isValidComponentSize = (val: string) =>