eraseCookiesHelper = (cookies, customPath, customDomain) => {
    if (cookies.length === 0)
        return;

    const domain = customDomain || globalObj._config.cookie.domain;
    const path = customPath || globalObj._config.cookie.path;
    const isWwwSubdomain = domain.slice(0, 4) === 'www.';
    const mainDomain = isWwwSubdomain && domain.substring(4);

    /**
     * Helper function to erase cookie
     * @param {string} cookie
     * @param {string} [domain]
     */
    const erase = (cookie, domain) => {
        if (domain && domain.slice(0, 1) !== '.')
            domain = '.' + domain;
        document.cookie = cookie + '='
            + '; path=' + path
            + (domain ? '; domain=' + domain : '')
            + '; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
    };

    for (const cookieName of cookies) {
        erase(cookieName, customDomain);

        /**
         * If custom domain not specified,
         * also erase config domain
         */
        if (!customDomain) {
            erase(cookieName, domain);
        }

        /**
         * If domain starts with 'www.',
         * also erase the cookie for the
         * main domain (without www)
         */
        if (isWwwSubdomain)
            erase(cookieName, mainDomain);

        debug('CookieConsent [AUTOCLEAR]: deleting cookie: "' + cookieName + '" path: "' + path + '" domain:', domain);
    }
}
Delete cookie by name & path
@param {string[]} cookies Array of cookie names
@param {string} [customPath]
@param {string} [customDomain]