function attachModuleSymbols(doclets, modules) {
    const symbols = {};

    // build a lookup table
    doclets.forEach(symbol => {
        symbols[symbol.longname] = symbols[symbol.longname] || [];
        symbols[symbol.longname].push(symbol);
    });

    modules.forEach(module => {
        if (symbols[module.longname]) {
            module.modules = symbols[module.longname]
                // Only show symbols that have a description. Make an exception for classes, because
                // we want to show the constructor-signature heading no matter what.
                .filter(({description, kind}) => description || kind === 'class')
                .map(symbol => {
                    symbol = doop(symbol);

                    if (symbol.kind === 'class' || symbol.kind === 'function') {
                        symbol.name = `${symbol.name.replace('module:', '(require("')}"))`;
                    }

                    return symbol;
                });
        }
    });
}
Look for classes or functions with the same name as modules (which indicates that the module
exports only that class or function), then attach the classes or functions to the `module`
property of the appropriate module doclets. The name of each class or function is also updated
for display purposes. This function mutates the original arrays.

@private
@param {Array<module:jsdoc/doclet.Doclet>} doclets - The array of classes and functions to
check.
@param {Array<module:jsdoc/doclet.Doclet>} modules - The array of module doclets to search.