mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
14 lines
573 B
TypeScript
14 lines
573 B
TypeScript
import type { SizeType } from '../config-provider/SizeContext';
|
|
|
|
export function isPresetSize(size?: SizeType | string | number): size is SizeType {
|
|
return ['small', 'middle', 'large'].includes(size as string);
|
|
}
|
|
|
|
export function isValidGapNumber(size?: SizeType | string | number): size is number {
|
|
if (!size) {
|
|
// The case of size = 0 is deliberately excluded here, because the default value of the gap attribute in CSS is 0, so if the user passes 0 in, we can directly ignore it.
|
|
return false;
|
|
}
|
|
return typeof size === 'number' && !Number.isNaN(size);
|
|
}
|