mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-15 13:38:29 +02:00
8 lines
245 B
TypeScript
8 lines
245 B
TypeScript
const toList = <T>(candidate: T | T[], skipEmpty = false): T[] => {
|
|
if (skipEmpty && (candidate === undefined || candidate === null)) {
|
|
return [];
|
|
}
|
|
return Array.isArray(candidate) ? candidate : [candidate];
|
|
};
|
|
|
|
export default toList;
|