diff --git a/lib/index.js b/lib/index.js index 476b7a4..44e0811 100644 --- a/lib/index.js +++ b/lib/index.js @@ -2,26 +2,27 @@ export default function cache (config = {}) { if (!config.store) { - throw new Error('Cache middleware need to be provided a store.'); + throw new Error('Cache middleware need to be provided a store.') } - const store = config.store; - const cache = config.cache; + const store = config.store + const cache = config.cache if (!config.cache || typeof config.cache !== 'function') { - throw new Error('Cache middleware need a cache function.'); + throw new Error('Cache middleware need a cache function.') } return (req, next, service) => { const useCache = !service.use || (service.use && (service.use.cache !== false)) if (!useCache) { - return next(); + return next() + } } const promise = next() promise.then(cache) - return promise; + return promise } }