{"size": 925, "ext": "js", "max_stars_repo_path": "src/util.js", "max_stars_repo_name": "MattIPv4/web-whois", "max_stars_repo_stars_event_min_datetime": "2021-02-02T20:25:18.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-25T13:01:45.000Z", "max_issues_repo_path": "src/util.js", "max_issues_repo_name": "MattIPv4/web-whois", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/util.js", "max_forks_repo_name": "MattIPv4/web-whois", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 9, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 46.25, "max_line_length": 105, "alphanum_fraction": 0.6010810811}
// Unique values in an array, comma-separated
module.exports.uniqueCommaSep = arr => [...new Set(arr)].join(', ');

const trimmed = item => item && `${item}`.trim();

// Consistent keys for the response from the package
module.exports.consistentResultObj = data => ({
    name:           trimmed(data.name)          || undefined,
    registrant:     trimmed(data.registrant)    || undefined,
    asn:            trimmed(data.asn)           || undefined,
    registrar:      trimmed(data.registrar)     || undefined,
    registration:   data.registration           || undefined,
    expiration:     data.expiration             || undefined,
    cidr:           trimmed(data.cidr)          || undefined,
    abuse:          trimmed(data.abuse)         || undefined,
});

// If we found nothing, the package returns false
module.exports.consistentResult = data => Object.values(data).every(x => x === undefined) ? false : data;
