File size: 245 Bytes
1e92f2d
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
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;