Use early return

This commit is contained in:
IagoLast 2018-06-13 09:38:24 +02:00
parent 0cf6605b8d
commit ae7e7578db

View File

@ -35,19 +35,20 @@ function _castColumnToEpoch(columnName) {
} }
function getColumnsWithWrappedDates(query) { function getColumnsWithWrappedDates(query) {
if (query) { if(!query){
if (query.match(/\b_cdb_epoch_transformation\b/)) { return;
const columns = []; }
const fieldMatcher = /\bdate_part\('epoch', "([^"]+)"\) as "([^"]+)"/gmi; if (query.match(/\b_cdb_epoch_transformation\b/)) {
let match; const columns = [];
do { const fieldMatcher = /\bdate_part\('epoch', "([^"]+)"\) as "([^"]+)"/gmi;
match = fieldMatcher.exec(query); let match;
if (match && match[1] === match[2]) { do {
columns.push(match[1]); match = fieldMatcher.exec(query);
} if (match && match[1] === match[2]) {
} while (match); columns.push(match[1]);
return columns; }
} } while (match);
return columns;
} }
} }