to-array-from-csv.ts 249 B

12345678910111213
  1. // converts csv item to array
  2. export const toArrayFromCsv = (text: string): string[] => {
  3. if (text == null) {
  4. return [];
  5. }
  6. const array = text
  7. .split(',')
  8. .map((el) => el.trim())
  9. .filter((el) => el !== '');
  10. return array;
  11. };