From 438ecd5598bc37376461bde2d82b97ec45434b33 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Sun, 15 Mar 2015 23:56:14 +0100 Subject: [PATCH] jshint: fix Function declarations should not be placed in blocks --- .jshintrc | 2 +- lib/cartodb/cartodb_windshaft.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.jshintrc b/.jshintrc index 767df861..2b7a9367 100644 --- a/.jshintrc +++ b/.jshintrc @@ -8,7 +8,7 @@ // "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) // "camelcase" : false, // true: Identifiers must be in camelCase // "curly" : true, // true: Require {} for every new block or scope - "eqeqeq" : true, // true: Require triple equals (===) for comparison +// "eqeqeq" : true, // true: Require triple equals (===) for comparison "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() "freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. "immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index 53f731f7..82da2d68 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -54,15 +54,15 @@ var CartodbWindshaft = function(serverOptions) { varnishHttpCacheBackend = new VarnishHttpCacheBackend(serverOptions.varnish_host, serverOptions.varnish_http_port), surrogateKeysCache = new SurrogateKeysCache(varnishHttpCacheBackend); - if (serverOptions.varnish_purge_enabled) { - function invalidateNamedMap(owner, templateName) { - surrogateKeysCache.invalidate(new NamedMapsCacheEntry(owner, templateName), function(err) { - if (err) { - console.warn('Cache: surrogate key invalidation failed'); - } - }); - } + function invalidateNamedMap (owner, templateName) { + surrogateKeysCache.invalidate(new NamedMapsCacheEntry(owner, templateName), function(err) { + if (err) { + console.warn('Cache: surrogate key invalidation failed'); + } + }); + } + if (serverOptions.varnish_purge_enabled) { ['update', 'delete'].forEach(function(eventType) { templateMaps.on(eventType, invalidateNamedMap); });