From de26ae361292d34ea36bbd34e42253c8e0131fc3 Mon Sep 17 00:00:00 2001 From: Andrew Shaffer Date: Tue, 17 May 2016 16:06:56 -0700 Subject: [PATCH] fix style --- lib/fsevents-handler.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/fsevents-handler.js b/lib/fsevents-handler.js index b16c28a2..366843fb 100644 --- a/lib/fsevents-handler.js +++ b/lib/fsevents-handler.js @@ -12,6 +12,10 @@ try { fsevents = require('fsevents'); } catch (error) {} // (may be shared across chokidar FSWatcher instances) var FSEventsWatchers = Object.create(null); +// Threshold of duplicate path prefixes at which to start +// consolidating going forward +var consolidateThreshhold = 10; + // Private function: Instantiates the fsevents interface // * path - string, path to be watched @@ -98,26 +102,23 @@ function setFSEventsListener(path, realPath, listener, rawEmitter) { }; } -var consolidateThreshhold = 10; - // Decide whether or not we should start a new higher-level // parent watcher function couldConsolidate(path) { - var candidates = {}; - var keys = Object.keys(FSEventsWatchers) - var count = 0 + var keys = Object.keys(FSEventsWatchers); + var count = 0; for (var i = 0, len = keys.length; i < len; ++i) { - var watchPath = keys[i] + var watchPath = keys[i]; if (watchPath.indexOf(path) === 0) { - count++ + count++; if (count >= consolidateThreshhold) { - return true + return true; } } } - return false + return false; } // Find the parent of a given path