Be careful and detect type invalid types
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user