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