code: function checkForChangedFiles(dir) {
      var fileList = fs.readdirSync(dir);
      for (var i=0;i<fileList.length;i++) {
          if (!isWatching(fileList[i])) {
              continue;
          }
          if (!fs.existsSync(dir+fileList[i])) { continue; }
          var stats;
          try {
              stats = fs.statSync(dir + fileList[i]);
          }
          catch (err) {
              // this means the file disappeared between the exists and when we tried to stat it...
              continue;
          }
          if (timeStamps[dir+fileList[i]] === undefined || timeStamps[dir+fileList[i]] !== stats.mtime.getTime()) {
              //console.log("Found 1: ", dir+fileList[i], timeStamps[dir+fileList[i]], stats.mtime.getTime());
  
              timeStamps[dir+fileList[i]] = stats.mtime.getTime();
              return dir+fileList[i];
          }
      }
      return null;
  }
docs: check for any changed files on platforms (Mac's) that don't pass a filename in the callback
  @param dir
  @returns {*}