Utils.ts 351 B

123456789101112131415
  1. export function transformSomeToArray(source: any) {
  2. if (typeof source === 'string')
  3. return source.split(',');
  4. if (typeof source === 'object') {
  5. if (source instanceof Array)
  6. return source;
  7. else {
  8. const arr = [];
  9. for (const key in source)
  10. arr.push(source[key]);
  11. return arr;
  12. }
  13. }
  14. return source;
  15. }