Use early return
This commit is contained in:
parent
ae7e7578db
commit
649297df83
@ -38,21 +38,22 @@ function getColumnsWithWrappedDates(query) {
|
||||
if(!query){
|
||||
return;
|
||||
}
|
||||
if (query.match(/\b_cdb_epoch_transformation\b/)) {
|
||||
const columns = [];
|
||||
const fieldMatcher = /\bdate_part\('epoch', "([^"]+)"\) as "([^"]+)"/gmi;
|
||||
let match;
|
||||
do {
|
||||
match = fieldMatcher.exec(query);
|
||||
if (match && match[1] === match[2]) {
|
||||
columns.push(match[1]);
|
||||
}
|
||||
} while (match);
|
||||
return columns;
|
||||
if (!query.match(/\b_cdb_epoch_transformation\b/)) {
|
||||
return;
|
||||
}
|
||||
const columns = [];
|
||||
const fieldMatcher = /\bdate_part\('epoch', "([^"]+)"\) as "([^"]+)"/gmi;
|
||||
let match;
|
||||
do {
|
||||
match = fieldMatcher.exec(query);
|
||||
if (match && match[1] === match[2]) {
|
||||
columns.push(match[1]);
|
||||
}
|
||||
} while (match);
|
||||
return columns;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
wrapDates,
|
||||
getColumnsWithWrappedDates
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user