toList.js 226 B

1234567
  1. const toList = (candidate, skipEmpty = false) => {
  2. if (skipEmpty && (candidate === undefined || candidate === null)) {
  3. return [];
  4. }
  5. return Array.isArray(candidate) ? candidate : [candidate];
  6. };
  7. export default toList;