code: function mapDirectory(rootDir, subDir, include, exclude) {
      var dirMap = { "": { subDir: subDir, stats: fs.statSync(path.join(rootDir, subDir)) } };
      mapSubdirectory(rootDir, subDir, "", include, exclude, dirMap);
      return dirMap;
  
      function mapSubdirectory(rootDir, subDir, relativeDir, include, exclude, dirMap) {
          var itemMapped = false;
          var items = fs.readdirSync(path.join(rootDir, subDir, relativeDir));
  
          items.forEach(function(item) {
              var relativePath = path.join(relativeDir, item);
              if(!matchGlobArray(relativePath, exclude)) {
                  // Stats obtained here (required at least to know where to recurse in directories)
                  // are saved for later, where the modified times may also be used. This minimizes
                  // the number of file I/O operations performed.
                  var fullPath = path.join(rootDir, subDir, relativePath);
                  var stats = fs.statSync(fullPath);
  
                  if (stats.isDirectory()) {
                      // Directories are included if either something under them is included or they
                      // match an include glob.
                      if (mapSubdirectory(rootDir, subDir, relativePath, include, exclude, dirMap) ||
                              matchGlobArray(relativePath, include)) {
                          dirMap[relativePath] = { subDir: subDir, stats: stats };
                          itemMapped = true;
                      }
                  } else if (stats.isFile()) {
                      // Files are included only if they match an include glob.
                      if (matchGlobArray(relativePath, include)) {
                          dirMap[relativePath] = { subDir: subDir, stats: stats };
                          itemMapped = true;
                      }
                  }
              }
          });
          return itemMapped;
      }
  
      function matchGlobArray(path, globs) {
          return globs.some(function(elem) {
              return minimatch(path, elem, {dot:true});
          });
      }
  }
docs: Creates a dictionary map of all files and directories under a path.