I have this function
validarcsv(){
 let text;
 fs.createReadStream('data.csv')
  .pipe(csv())
  .on('data', (data) => results.push(data))
  .on('end', () => {
    text = result[0].something
    return text;
  });
}
and what i'm triyng to do is retrieve the value of the function like this
let value = validarcsv();
console.log(value);
it's showing me undefined
how can i return the value of that function i'm stuck on that one
 
    