Browse Source

adjust test

itizawa 5 years ago
parent
commit
5144a15fe3
1 changed files with 3 additions and 7 deletions
  1. 3 7
      src/lib/util/to-array-from-csv.js

+ 3 - 7
src/lib/util/to-array-from-csv.js

@@ -1,17 +1,13 @@
 // converts csv item to array
 // converts csv item to array
 const toArrayFromCsv = (text) => {
 const toArrayFromCsv = (text) => {
-  const array = [];
+  let array = [];
 
 
   if (text == null) {
   if (text == null) {
     return array;
     return array;
   }
   }
 
 
-  text.split(',').forEach((element) => {
-    const trimedElement = element.trim();
-    if (trimedElement !== '') {
-      array.push(trimedElement);
-    }
-  });
+  array = text.split(',').map(el => el.trim());
+  array = array.filter(el => el !== '');
 
 
   return array;
   return array;
 };
 };