UNPKG

@analytics/cookie-utils

Version:
3 lines (2 loc) 763 B
import{set as e,get as o,remove as n}from"@analytics/global-storage-utils";var t="cookie",i=a(),r=d,c=d;function u(e){return i?d(e,"",-1):n(e)}function a(){if(void 0!==i)return i;var e=t+t;try{d(e,e),i=-1!==document.cookie.indexOf(e),u(e)}catch(e){i=!1}return i}function d(n,t,r,c,u,a){if("undefined"!=typeof window){var d=arguments.length>1;return!1===i&&(d?e(n,t):o(n)),d?document.cookie=n+"="+encodeURIComponent(t)+(r?"; expires="+new Date(+new Date+1e3*r).toUTCString()+(c?"; path="+c:"")+(u?"; domain="+u:"")+(a?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+n+"=")[1]||"").split(";")[0])}}export{t as COOKIE,r as getCookie,a as hasCookies,u as removeCookie,c as setCookie}; //# sourceMappingURL=analytics-util-cookie.module.js.map