function detectLegacyJavaScript(content, map) {
  if (!content) return {matches: [], estimatedByteSavings: 0};

  // Start with pattern matching against the downloaded script.
  let matches = matcher.match(content);

  // If it's a bundle with source maps, add in the polyfill modules by name too.
  if (map) {
    for (const {name, modules} of polyfillModuleData) {
      // Skip if the pattern matching found a match for this polyfill.
      if (matches.some(m => m.name === name)) continue;

      const source = map.sourceURLs().find(source => modules.some(module => {
        return source.endsWith(`/${module}.js`) || source.includes(`node_modules/${module}/`);
      }));
      if (!source) continue;

      const mapping = map.mappings().find(m => m.sourceURL === source);
      if (mapping) {
        matches.push({name, line: mapping.lineNumber, column: mapping.columnNumber});
      } else {
        matches.push({name, line: 0, column: 0});
      }
    }
  }

  matches = matches.sort((a, b) => a.name > b.name ? 1 : a.name === b.name ? 0 : -1);

  return {
    matches,
    estimatedByteSavings: estimateWastedBytes(content, matches),
  };
}
@param {string} content
@param {import('../cdt/generated/SourceMap.js')|null} map
@return {Result}