node-csvtojson icon indicating copy to clipboard operation
node-csvtojson copied to clipboard

Trim option does not work

Open JimmyBeldone opened this issue 3 years ago • 1 comments

Hi,

Thanks for your amazing work !

It seems that trim default value option does not work, even if I add it top options.

This is my test :

const csv = require('csvtojson');

const csvFilePath = 'src/contents/csv/projects.csv';

csv({ trim: true })
    .fromFile(csvFilePath)
    .then((jsonObj) => {
        console.log(jsonObj);
    });

And a part of the output :

...,
{
    type_de_travaux: 'Démolir ',
    stars_number: '4.5',
    stars_vote: '0',
  },
...,

Am I doing something wrong ?

I tried adding space at the beginning of a string and the result is the same.

JimmyBeldone avatar Oct 19 '22 11:10 JimmyBeldone

same here

edeebee avatar Mar 29 '23 10:03 edeebee