mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-24 15:46:10 +08:00
14 lines
378 B
TypeScript
14 lines
378 B
TypeScript
|
export function toList<T extends any>(val: T | T[]): T[] {
|
||
|
if (val === false) {
|
||
|
return [false, false] as T[];
|
||
|
}
|
||
|
return Array.isArray(val) ? val : [val];
|
||
|
}
|
||
|
|
||
|
export function getNode(dom: React.ReactNode, defaultNode: React.ReactNode, needDom?: boolean) {
|
||
|
if (dom === true || dom === undefined) {
|
||
|
return defaultNode;
|
||
|
}
|
||
|
return dom || (needDom && defaultNode);
|
||
|
}
|