{"size": 752, "ext": "js", "max_stars_repo_path": "core/server/api/shared/serializers/input/utils/settings-filter-type-group-mapper.js", "max_stars_repo_name": "getmindspun/ghost", "max_stars_repo_stars_event_min_datetime": "2015-01-01T01:11:37.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T18:52:13.000Z", "max_issues_repo_path": "core/server/api/shared/serializers/input/utils/settings-filter-type-group-mapper.js", "max_issues_repo_name": "getmindspun/ghost", "max_issues_repo_issues_event_min_datetime": "2015-01-01T12:29:16.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T17:58:30.000Z", "max_forks_repo_path": "core/server/api/shared/serializers/input/utils/settings-filter-type-group-mapper.js", "max_forks_repo_name": "getmindspun/ghost", "max_forks_repo_forks_event_min_datetime": "2015-01-01T05:00:00.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T15:47:31.000Z"}
{"max_stars_count": 31697, "max_issues_count": 6768, "max_forks_count": 10906, "avg_line_length": 16.347826087, "max_line_length": 56, "alphanum_fraction": 0.4654255319}
const typeGroupMapping = {
    core: [
        'core'
    ],
    blog: [
        'site',
        'amp',
        'labs',
        'slack',
        'unsplash',
        'views'
    ],
    theme: [
        'theme'
    ],
    members: [
        'members'
    ],
    private: [
        'private'
    ],
    portal: [
        'portal'
    ],
    bulk_email: [
        'email'
    ],
    site: [
        'site'
    ]
};

const mapTypeToGroup = (typeOptions) => {
    const types = typeOptions.split(',');

    const mappedTypes = types.map((type) => {
        const sanitizedType = type ? type.trim() : null;

        return typeGroupMapping[sanitizedType];
    }).filter(type => !!type);

    return mappedTypes.join(',');
};

module.exports = mapTypeToGroup;
