mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 01:29:11 +08:00
72ee4517f0
* chore: init * chore: ellpsis check with native css * docs: all the lines * chore: move copied btn out * chore: add dpes * fix: logic order * fix: ellipsis event * test: update testcase * chore: use native way * chore: destructure * chore: fix lint * chore: fix lint * chore: fix lint
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);
|
|
}
|