mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 15:19:58 +08:00
3b8ea07a8a
* test: test driven * test: test driven * fix: test case
6 lines
223 B
TypeScript
6 lines
223 B
TypeScript
export default function toList<T>(candidate: T | T[], skipEmpty = false): T[] {
|
|
if (skipEmpty && (candidate === undefined || candidate === null)) return [];
|
|
|
|
return Array.isArray(candidate) ? candidate : [candidate];
|
|
}
|