ant-design/components/typography/Base/util.ts
二货爱吃白萝卜 72ee4517f0
refactor: Use native css for measure css line ellipsis (#47597)
* 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
2024-02-27 16:56:24 +08:00

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);
}