element-plus/packages/utils/validators.ts
jeremywu 06731d8e70
fix(project): fix/1778-import-on-demand-not-working (#1788)
* fix(project): fix/1778-import-on-demand-not-working

- Fix the issue that when building utils the functions are inlined

* - remove unnecessary variable
2021-04-09 10:00:21 +08:00

16 lines
402 B
TypeScript

import { isNumber } from '@element-plus/utils/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),
)
}
}
export const isValidComponentSize = (val: string) =>
['', 'large', 'medium', 'small', 'mini'].includes(val)