Keyang / node-csvtojson

Blazing fast and Comprehensive CSV Parser for Node.JS / Browser / Command Line.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

return undefined

alicera opened this issue · comments

https://github.com/Keyang/node-csvtojson#from-csv-file-to-json-array

function csv2json(filename) {
    // convert users.csv file to JSON array
    CSVToJSON().fromFile(filename)
    .then(users => {
        // users is a JSON array
        // log the JSON array
        //console.log(users);
        return users;
    }).catch(err => {
        // log error if any
        console.log(err);
    });
    }

It will undefined.
My subject is using the function to get json result and let it return.