Improve readability

This commit is contained in:
Daniel García Aubert 2019-07-04 16:24:17 +02:00
parent 5ca498d0f3
commit ec0c0eb810

View File

@ -25,9 +25,9 @@ module.exports = function setCacheControlHeader ({
const directives = [ 'public' ];
if (everyAffectedTablesCanBeInvalidated(affectedTables)) {
directives.push(`max-age=${fallbackTtl}`);
} else {
directives.push(`max-age=${ttl}`);
} else {
directives.push(`max-age=${fallbackTtl}`);
}
if (revalidate) {
@ -42,5 +42,5 @@ module.exports = function setCacheControlHeader ({
};
function everyAffectedTablesCanBeInvalidated (affectedTables) {
return affectedTables && affectedTables.getTables().some(table => !table.updated_at);
return affectedTables && affectedTables.getTables().every(table => !!table.updated_at);
}