mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-17 23:50:52 +08:00
9 lines
245 B
TypeScript
9 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;
|