element-plus/packages/utils/validators.ts

8 lines
250 B
TypeScript
Raw Normal View History

export const isValidWidthUnit = (val: string) =>
['px', 'rem', 'em', 'vw', '%', 'vmin', 'vmax'].some(unit =>
val.endsWith(unit),
)
2020-10-30 23:26:33 +08:00
export const isValidComponentSize = (val: string) =>
['', 'large', 'medium', 'small', 'mini'].includes(val)