From 701849eb5a832f1f14cf990ec1bd5760107c16bc Mon Sep 17 00:00:00 2001 From: Harsh Patel Date: Thu, 31 Jan 2019 20:20:56 -0500 Subject: [PATCH] Fixed #707 Replaced var with const and let and added strict mode (#712) * Fixed #707 Replaced var with const and let and added strict mode * Fixed src/fs-watcher.js and changed remaining var to let * Changed src/fs-watcher.js file to use const instead of let at line 52 and 57 --- src/fs-watcher.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/fs-watcher.js b/src/fs-watcher.js index e236bcb..c7e7f1b 100644 --- a/src/fs-watcher.js +++ b/src/fs-watcher.js @@ -1,6 +1,8 @@ -var EventEmitter = require('../lib/eventemitter.js'); -var Path = require('./path.js'); -var Intercom = require('../lib/intercom.js'); +'using strict'; + +const EventEmitter = require('../lib/eventemitter.js'); +const Path = require('./path.js'); +const Intercom = require('../lib/intercom.js'); /** * FSWatcher based on node.js' FSWatcher @@ -8,10 +10,10 @@ var Intercom = require('../lib/intercom.js'); */ function FSWatcher() { EventEmitter.call(this); - var self = this; - var recursive = false; - var recursivePathPrefix; - var filename; + const self = this; + let recursive = false; + let recursivePathPrefix; + let filename; function onchange(path) { // Watch for exact filename, or parent path when recursive is true. @@ -46,12 +48,12 @@ function FSWatcher() { recursivePathPrefix = filename === '/' ? '/' : filename + '/'; } - var intercom = Intercom.getInstance(); + const intercom = Intercom.getInstance(); intercom.on('change', onchange); }; self.close = function() { - var intercom = Intercom.getInstance(); + const intercom = Intercom.getInstance(); intercom.off('change', onchange); self.removeAllListeners('change'); };