Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var infer = function(filename, callback) {
var f = filename.toLowerCase();
var delimiter = (f.match(/csv/))? ",": "\t";
if (filename.indexOf("://") === -1) { //uploaded file
couchimport.previewCSVFile(filename, { COUCH_DELIMITER: delimiter}, function(err, data) {
handleResponse(err, data, callback);
});
}
else { //file url
couchimport.previewURL(filename, { COUCH_DELIMITER: delimiter}, function(err, data) {
handleResponse(err, data, callback);
});
}
};