{"size": 954, "ext": "js", "max_stars_repo_path": "src/config-render.js", "max_stars_repo_name": "VitaliyR/single-config", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/config-render.js", "max_issues_repo_name": "VitaliyR/single-config", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/config-render.js", "max_forks_repo_name": "VitaliyR/single-config", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 41.4782608696, "max_line_length": 105, "alphanum_fraction": 0.6215932914}
function renderConfig(options, mappedConfig) {
    const { moduleType } = options;
    let moduleDefinition = `// This file was automatically generated at ${(new Date()).toISOString()}\n`;

    if (moduleType === 'node') {
        moduleDefinition += `module.exports = ${JSON.stringify(mappedConfig, null, 4)};\n`;
    } else if (moduleType === 'globals') {
        let globalVarName = options.globalModuleName || 'config';
        moduleDefinition += `${globalVarName} = ${JSON.stringify(mappedConfig, null, 4)};\n`;
    } else if (moduleType === 'esm') {
        let defaultExportKeys = [];
        for (let [key, field] of Object.entries(mappedConfig)) {
            moduleDefinition += `export const ${key} = ${JSON.stringify(field, null, 4)};\n`;
            defaultExportKeys.push(key);
        }
        moduleDefinition += `export default {${defaultExportKeys.join(', ')}};`;
    }

    return moduleDefinition;
}

module.exports = renderConfig;
