{"size": 611, "ext": "js", "max_stars_repo_path": "src/lib/util.js", "max_stars_repo_name": "veritasnz/next-wordless-front", "max_stars_repo_stars_event_min_datetime": "2022-03-09T06:05:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-09T06:05:16.000Z", "max_issues_repo_path": "src/lib/util.js", "max_issues_repo_name": "veritasnz/next-wordless-front", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/lib/util.js", "max_forks_repo_name": "veritasnz/next-wordless-front", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.09375, "max_line_length": 77, "alphanum_fraction": 0.5466448445}

/**
 * decodeHtmlEntities
 */

export function decodeHtmlEntities(text) {
    if (typeof text !== "string") {
        throw new Error(
            `Failed to decode HTML entity: invalid type ${typeof text}`
        );
    }

    let decoded = text;

    const entities = {
        "&amp;": "\u0026",
        "&quot;": "\u0022",
        "&#039;": "\u0027",
    };

    return decoded.replace(/&amp;|&quot;|&#039;/g, (char) => entities[char]);
}

/**
 * removeLastTrailingSlash
 */

export function removeLastTrailingSlash(url) {
    if (typeof url !== "string") return url;
    return url.replace(/\/$/, "");
}
