mapBundleOutput(format, parsedRootFiles, version, options = {}) {
    return (contentAndComponents) => {
      let bundledFile = contentAndComponents.fileContent,
        bundleOutput;

      if (isSwagger(version)) {
        _.isObject(contentAndComponents.components) &&
          Object.entries(contentAndComponents.components).forEach(([key, value]) => {
            bundledFile[key] = value;
          });
      }
      else if (!_.isEmpty(contentAndComponents.components)) {
        bundledFile.components = contentAndComponents.components;
      }
      if (!format) {
        let rootFormat = parsedRootFiles.find((inputRoot) => {
          return inputRoot.fileName === contentAndComponents.fileName;
        }).parsed.inputFormat;
        if (rootFormat.toLowerCase() === parse.YAML_FORMAT) {
          bundledFile = parse.toYAML(bundledFile);
        }
        else if (rootFormat.toLowerCase() === parse.JSON_FORMAT) {
          bundledFile = parse.toJSON(bundledFile, null);
        }
      }
      else if (format.toLowerCase() === parse.YAML_FORMAT) {
        bundledFile = parse.toYAML(bundledFile);
      }
      else if (format.toLowerCase() === parse.JSON_FORMAT) {
        bundledFile = parse.toJSON(bundledFile, null);
      }

      bundleOutput = {
        rootFile: { path: contentAndComponents.fileName },
        bundledContent: bundledFile
      };

      if (options.includeReferenceMap) {
        bundleOutput.referenceMap = contentAndComponents.referenceMap;
      }
      return bundleOutput;
    };
  }
Maps the output for each bundled root file
@param {object} format - defined output format from options
@param {string} parsedRootFiles - The parsed root files
@param {string} version - specified version of the process
@param {object} options - a standard list of options that's globally passed around. Check options.js for more.
@returns {object} -  { rootFile: { path }, bundledContent }