itizawa %!s(int64=5) %!d(string=hai) anos
pai
achega
0f267308ba

+ 8 - 2
src/lib/util/to-array-from-csv.js

@@ -1,10 +1,16 @@
 // converts csv item to array
 const toArrayFromCsv = (text) => {
+  const array = [];
+
   if (text == null) {
-    return [];
+    return array;
   }
 
-  return text.split(',');
+  text.split(',').forEach((element) => {
+    array.push(element.trim());
+  });
+
+  return array;
 };
 
 module.exports = toArrayFromCsv;

+ 1 - 1
src/test/libs/to-array-from-csv.test.js

@@ -1,4 +1,4 @@
-const toArrayFromCsv = require('../../lib/util/toArrayFromCsv');
+const toArrayFromCsv = require('@commons/util/to-array-from-csv');
 
 describe('To array from csv', () => {