Be careful and detect type invalid types

This commit is contained in:
Javier Goizueta
2018-05-28 17:36:58 +02:00
parent 34a2f3b32b
commit 8a1d5d3a48
+5 -2
View File
@@ -92,10 +92,13 @@ function columnSelector(columns) {
if (!columns) {
return '*';
}
if (typeof(columns) === 'string') {
if (typeof columns === 'string') {
return columns;
}
return columns.map(name => `"${name}"`).join(', ');
if (Array.isArray(columns)) {
return columns.map(name => `"${name}"`).join(', ');
}
throw new TypeError(`Bad argument type for columns: ${typeof columns}`);
}
module.exports.getQuerySample = function(query, sampleProb, limit = null, randomSeed = 0.5, columns = null) {