universal-cookie
Advanced tools
Comparing version 6.1.3 to 7.0.0
192
cjs/index.js
@@ -1,22 +0,174 @@ | ||
"use strict"; | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _exportNames = {}; | ||
exports["default"] = void 0; | ||
var _Cookies = _interopRequireDefault(require("./Cookies")); | ||
var _types = require("./types"); | ||
Object.keys(_types).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _types[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _types[key]; | ||
var cookie = require('cookie'); | ||
function _interopNamespaceDefault(e) { | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _default = exports["default"] = _Cookies["default"]; | ||
n.default = e; | ||
return Object.freeze(n); | ||
} | ||
var cookie__namespace = /*#__PURE__*/_interopNamespaceDefault(cookie); | ||
function hasDocumentCookie() { | ||
const testingValue = typeof global === 'undefined' | ||
? undefined | ||
: global.TEST_HAS_DOCUMENT_COOKIE; | ||
if (typeof testingValue === 'boolean') { | ||
return testingValue; | ||
} | ||
// Can we get/set cookies on document.cookie? | ||
return typeof document === 'object' && typeof document.cookie === 'string'; | ||
} | ||
function parseCookies(cookies) { | ||
if (typeof cookies === 'string') { | ||
return cookie__namespace.parse(cookies); | ||
} | ||
else if (typeof cookies === 'object' && cookies !== null) { | ||
return cookies; | ||
} | ||
else { | ||
return {}; | ||
} | ||
} | ||
function readCookie(value, options = {}) { | ||
const cleanValue = cleanupCookieValue(value); | ||
if (!options.doNotParse) { | ||
try { | ||
return JSON.parse(cleanValue); | ||
} | ||
catch (e) { | ||
// At least we tried | ||
} | ||
} | ||
// Ignore clean value if we failed the deserialization | ||
// It is not relevant anymore to trim those values | ||
return value; | ||
} | ||
function cleanupCookieValue(value) { | ||
// express prepend j: before serializing a cookie | ||
if (value && value[0] === 'j' && value[1] === ':') { | ||
return value.substr(2); | ||
} | ||
return value; | ||
} | ||
class Cookies { | ||
constructor(cookies, defaultSetOptions = {}) { | ||
this.changeListeners = []; | ||
this.HAS_DOCUMENT_COOKIE = false; | ||
this.update = () => { | ||
if (!this.HAS_DOCUMENT_COOKIE) { | ||
return; | ||
} | ||
const previousCookies = this.cookies; | ||
this.cookies = cookie__namespace.parse(document.cookie); | ||
this._checkChanges(previousCookies); | ||
}; | ||
const domCookies = typeof document === 'undefined' ? '' : document.cookie; | ||
this.cookies = parseCookies(cookies || domCookies); | ||
this.defaultSetOptions = defaultSetOptions; | ||
this.HAS_DOCUMENT_COOKIE = hasDocumentCookie(); | ||
} | ||
_emitChange(params) { | ||
for (let i = 0; i < this.changeListeners.length; ++i) { | ||
this.changeListeners[i](params); | ||
} | ||
} | ||
_checkChanges(previousCookies) { | ||
const names = new Set(Object.keys(previousCookies).concat(Object.keys(this.cookies))); | ||
names.forEach((name) => { | ||
if (previousCookies[name] !== this.cookies[name]) { | ||
this._emitChange({ | ||
name, | ||
value: readCookie(this.cookies[name]), | ||
}); | ||
} | ||
}); | ||
} | ||
_startPolling() { | ||
this.pollingInterval = setInterval(this.update, 300); | ||
} | ||
_stopPolling() { | ||
if (this.pollingInterval) { | ||
clearInterval(this.pollingInterval); | ||
} | ||
} | ||
get(name, options = {}) { | ||
if (!options.doNotUpdate) { | ||
this.update(); | ||
} | ||
return readCookie(this.cookies[name], options); | ||
} | ||
getAll(options = {}) { | ||
if (!options.doNotUpdate) { | ||
this.update(); | ||
} | ||
const result = {}; | ||
for (let name in this.cookies) { | ||
result[name] = readCookie(this.cookies[name], options); | ||
} | ||
return result; | ||
} | ||
set(name, value, options) { | ||
if (options) { | ||
options = Object.assign(Object.assign({}, this.defaultSetOptions), options); | ||
} | ||
else { | ||
options = this.defaultSetOptions; | ||
} | ||
const stringValue = typeof value === 'string' ? value : JSON.stringify(value); | ||
this.cookies = Object.assign(Object.assign({}, this.cookies), { [name]: stringValue }); | ||
if (this.HAS_DOCUMENT_COOKIE) { | ||
document.cookie = cookie__namespace.serialize(name, stringValue, options); | ||
} | ||
this._emitChange({ name, value, options }); | ||
} | ||
remove(name, options) { | ||
const finalOptions = (options = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 })); | ||
this.cookies = Object.assign({}, this.cookies); | ||
delete this.cookies[name]; | ||
if (this.HAS_DOCUMENT_COOKIE) { | ||
document.cookie = cookie__namespace.serialize(name, '', finalOptions); | ||
} | ||
this._emitChange({ name, value: undefined, options }); | ||
} | ||
addChangeListener(callback) { | ||
this.changeListeners.push(callback); | ||
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1) { | ||
if (typeof window === 'object' && 'cookieStore' in window) { | ||
window.cookieStore.addEventListener('change', this.update); | ||
} | ||
else { | ||
this._startPolling(); | ||
} | ||
} | ||
} | ||
removeChangeListener(callback) { | ||
const idx = this.changeListeners.indexOf(callback); | ||
if (idx >= 0) { | ||
this.changeListeners.splice(idx, 1); | ||
} | ||
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0) { | ||
if (typeof window === 'object' && 'cookieStore' in window) { | ||
window.cookieStore.removeEventListener('change', this.update); | ||
} | ||
else { | ||
this._stopPolling(); | ||
} | ||
} | ||
} | ||
} | ||
module.exports = Cookies; |
@@ -1,1 +0,1 @@ | ||
export * from './es6'; | ||
export * from './esm'; |
{ | ||
"name": "universal-cookie", | ||
"version": "6.1.3", | ||
"version": "7.0.0", | ||
"description": "Universal cookies for JavaScript", | ||
"main": "cjs/index.js", | ||
"module": "es6/index.js", | ||
"types": "es6/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./esm/index.mjs", | ||
"require": "./cjs/index.js" | ||
} | ||
}, | ||
"types": "esm/index.d.ts", | ||
"sideEffects": false, | ||
"files": [ | ||
"lib", | ||
"es6", | ||
"esm", | ||
"cjs", | ||
@@ -31,8 +35,5 @@ "umd", | ||
"scripts": { | ||
"clean": "rimraf lib && rimraf es6 && rimraf cjs && rimraf umd", | ||
"build": "npm run clean && npm run build-es6 && npm run build-cjs && npm run build-umd && npm run build-legacy", | ||
"build-es6": "tsc", | ||
"build-cjs": "babel es6 -D -d cjs", | ||
"build-umd": "rollup -c", | ||
"build-legacy": "babel es6 -D -d lib" | ||
"prebuild": "rimraf esm && rimraf cjs && rimraf umd", | ||
"build": "rollup -c", | ||
"postbuild": "rimraf -G {cjs,umd}/*.d.ts" | ||
}, | ||
@@ -39,0 +40,0 @@ "dependencies": { |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.UniversalCookie = factory()); | ||
})(this, (function () { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('cookie')) : | ||
typeof define === 'function' && define.amd ? define(['cookie'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.UniversalCookie = factory(global.cookie)); | ||
})(this, (function (cookie) { 'use strict'; | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
function _interopNamespaceDefault(e) { | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n.default = e; | ||
return Object.freeze(n); | ||
} | ||
function getDefaultExportFromCjs (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
var cookie__namespace = /*#__PURE__*/_interopNamespaceDefault(cookie); | ||
var cjs = {}; | ||
function hasDocumentCookie() { | ||
const testingValue = typeof global === 'undefined' | ||
? undefined | ||
: global.TEST_HAS_DOCUMENT_COOKIE; | ||
if (typeof testingValue === 'boolean') { | ||
return testingValue; | ||
} | ||
// Can we get/set cookies on document.cookie? | ||
return typeof document === 'object' && typeof document.cookie === 'string'; | ||
} | ||
function parseCookies(cookies) { | ||
if (typeof cookies === 'string') { | ||
return cookie__namespace.parse(cookies); | ||
} | ||
else if (typeof cookies === 'object' && cookies !== null) { | ||
return cookies; | ||
} | ||
else { | ||
return {}; | ||
} | ||
} | ||
function readCookie(value, options = {}) { | ||
const cleanValue = cleanupCookieValue(value); | ||
if (!options.doNotParse) { | ||
try { | ||
return JSON.parse(cleanValue); | ||
} | ||
catch (e) { | ||
// At least we tried | ||
} | ||
} | ||
// Ignore clean value if we failed the deserialization | ||
// It is not relevant anymore to trim those values | ||
return value; | ||
} | ||
function cleanupCookieValue(value) { | ||
// express prepend j: before serializing a cookie | ||
if (value && value[0] === 'j' && value[1] === ':') { | ||
return value.substr(2); | ||
} | ||
return value; | ||
} | ||
var Cookies = {exports: {}}; | ||
class Cookies { | ||
constructor(cookies, defaultSetOptions = {}) { | ||
this.changeListeners = []; | ||
this.HAS_DOCUMENT_COOKIE = false; | ||
this.update = () => { | ||
if (!this.HAS_DOCUMENT_COOKIE) { | ||
return; | ||
} | ||
const previousCookies = this.cookies; | ||
this.cookies = cookie__namespace.parse(document.cookie); | ||
this._checkChanges(previousCookies); | ||
}; | ||
const domCookies = typeof document === 'undefined' ? '' : document.cookie; | ||
this.cookies = parseCookies(cookies || domCookies); | ||
this.defaultSetOptions = defaultSetOptions; | ||
this.HAS_DOCUMENT_COOKIE = hasDocumentCookie(); | ||
} | ||
_emitChange(params) { | ||
for (let i = 0; i < this.changeListeners.length; ++i) { | ||
this.changeListeners[i](params); | ||
} | ||
} | ||
_checkChanges(previousCookies) { | ||
const names = new Set(Object.keys(previousCookies).concat(Object.keys(this.cookies))); | ||
names.forEach((name) => { | ||
if (previousCookies[name] !== this.cookies[name]) { | ||
this._emitChange({ | ||
name, | ||
value: readCookie(this.cookies[name]), | ||
}); | ||
} | ||
}); | ||
} | ||
_startPolling() { | ||
this.pollingInterval = setInterval(this.update, 300); | ||
} | ||
_stopPolling() { | ||
if (this.pollingInterval) { | ||
clearInterval(this.pollingInterval); | ||
} | ||
} | ||
get(name, options = {}) { | ||
if (!options.doNotUpdate) { | ||
this.update(); | ||
} | ||
return readCookie(this.cookies[name], options); | ||
} | ||
getAll(options = {}) { | ||
if (!options.doNotUpdate) { | ||
this.update(); | ||
} | ||
const result = {}; | ||
for (let name in this.cookies) { | ||
result[name] = readCookie(this.cookies[name], options); | ||
} | ||
return result; | ||
} | ||
set(name, value, options) { | ||
if (options) { | ||
options = Object.assign(Object.assign({}, this.defaultSetOptions), options); | ||
} | ||
else { | ||
options = this.defaultSetOptions; | ||
} | ||
const stringValue = typeof value === 'string' ? value : JSON.stringify(value); | ||
this.cookies = Object.assign(Object.assign({}, this.cookies), { [name]: stringValue }); | ||
if (this.HAS_DOCUMENT_COOKIE) { | ||
document.cookie = cookie__namespace.serialize(name, stringValue, options); | ||
} | ||
this._emitChange({ name, value, options }); | ||
} | ||
remove(name, options) { | ||
const finalOptions = (options = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 })); | ||
this.cookies = Object.assign({}, this.cookies); | ||
delete this.cookies[name]; | ||
if (this.HAS_DOCUMENT_COOKIE) { | ||
document.cookie = cookie__namespace.serialize(name, '', finalOptions); | ||
} | ||
this._emitChange({ name, value: undefined, options }); | ||
} | ||
addChangeListener(callback) { | ||
this.changeListeners.push(callback); | ||
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1) { | ||
if (typeof window === 'object' && 'cookieStore' in window) { | ||
window.cookieStore.addEventListener('change', this.update); | ||
} | ||
else { | ||
this._startPolling(); | ||
} | ||
} | ||
} | ||
removeChangeListener(callback) { | ||
const idx = this.changeListeners.indexOf(callback); | ||
if (idx >= 0) { | ||
this.changeListeners.splice(idx, 1); | ||
} | ||
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0) { | ||
if (typeof window === 'object' && 'cookieStore' in window) { | ||
window.cookieStore.removeEventListener('change', this.update); | ||
} | ||
else { | ||
this._stopPolling(); | ||
} | ||
} | ||
} | ||
} | ||
var cookie$1 = {}; | ||
return Cookies; | ||
/*! | ||
* cookie | ||
* Copyright(c) 2012-2014 Roman Shtylman | ||
* Copyright(c) 2015 Douglas Christopher Wilson | ||
* MIT Licensed | ||
*/ | ||
/** | ||
* Module exports. | ||
* @public | ||
*/ | ||
cookie$1.parse = parse; | ||
cookie$1.serialize = serialize; | ||
/** | ||
* Module variables. | ||
* @private | ||
*/ | ||
var __toString = Object.prototype.toString; | ||
/** | ||
* RegExp to match field-content in RFC 7230 sec 3.2 | ||
* | ||
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] | ||
* field-vchar = VCHAR / obs-text | ||
* obs-text = %x80-FF | ||
*/ | ||
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; | ||
/** | ||
* Parse a cookie header. | ||
* | ||
* Parse the given cookie header string into an object | ||
* The object has the various cookies as keys(names) => values | ||
* | ||
* @param {string} str | ||
* @param {object} [options] | ||
* @return {object} | ||
* @public | ||
*/ | ||
function parse(str, options) { | ||
if (typeof str !== 'string') { | ||
throw new TypeError('argument str must be a string'); | ||
} | ||
var obj = {}; | ||
var opt = options || {}; | ||
var dec = opt.decode || decode; | ||
var index = 0; | ||
while (index < str.length) { | ||
var eqIdx = str.indexOf('=', index); | ||
// no more cookie pairs | ||
if (eqIdx === -1) { | ||
break | ||
} | ||
var endIdx = str.indexOf(';', index); | ||
if (endIdx === -1) { | ||
endIdx = str.length; | ||
} else if (endIdx < eqIdx) { | ||
// backtrack on prior semicolon | ||
index = str.lastIndexOf(';', eqIdx - 1) + 1; | ||
continue | ||
} | ||
var key = str.slice(index, eqIdx).trim(); | ||
// only assign once | ||
if (undefined === obj[key]) { | ||
var val = str.slice(eqIdx + 1, endIdx).trim(); | ||
// quoted values | ||
if (val.charCodeAt(0) === 0x22) { | ||
val = val.slice(1, -1); | ||
} | ||
obj[key] = tryDecode(val, dec); | ||
} | ||
index = endIdx + 1; | ||
} | ||
return obj; | ||
} | ||
/** | ||
* Serialize data into a cookie header. | ||
* | ||
* Serialize the a name value pair into a cookie string suitable for | ||
* http headers. An optional options object specified cookie parameters. | ||
* | ||
* serialize('foo', 'bar', { httpOnly: true }) | ||
* => "foo=bar; httpOnly" | ||
* | ||
* @param {string} name | ||
* @param {string} val | ||
* @param {object} [options] | ||
* @return {string} | ||
* @public | ||
*/ | ||
function serialize(name, val, options) { | ||
var opt = options || {}; | ||
var enc = opt.encode || encode; | ||
if (typeof enc !== 'function') { | ||
throw new TypeError('option encode is invalid'); | ||
} | ||
if (!fieldContentRegExp.test(name)) { | ||
throw new TypeError('argument name is invalid'); | ||
} | ||
var value = enc(val); | ||
if (value && !fieldContentRegExp.test(value)) { | ||
throw new TypeError('argument val is invalid'); | ||
} | ||
var str = name + '=' + value; | ||
if (null != opt.maxAge) { | ||
var maxAge = opt.maxAge - 0; | ||
if (isNaN(maxAge) || !isFinite(maxAge)) { | ||
throw new TypeError('option maxAge is invalid') | ||
} | ||
str += '; Max-Age=' + Math.floor(maxAge); | ||
} | ||
if (opt.domain) { | ||
if (!fieldContentRegExp.test(opt.domain)) { | ||
throw new TypeError('option domain is invalid'); | ||
} | ||
str += '; Domain=' + opt.domain; | ||
} | ||
if (opt.path) { | ||
if (!fieldContentRegExp.test(opt.path)) { | ||
throw new TypeError('option path is invalid'); | ||
} | ||
str += '; Path=' + opt.path; | ||
} | ||
if (opt.expires) { | ||
var expires = opt.expires; | ||
if (!isDate(expires) || isNaN(expires.valueOf())) { | ||
throw new TypeError('option expires is invalid'); | ||
} | ||
str += '; Expires=' + expires.toUTCString(); | ||
} | ||
if (opt.httpOnly) { | ||
str += '; HttpOnly'; | ||
} | ||
if (opt.secure) { | ||
str += '; Secure'; | ||
} | ||
if (opt.partitioned) { | ||
str += '; Partitioned'; | ||
} | ||
if (opt.priority) { | ||
var priority = typeof opt.priority === 'string' | ||
? opt.priority.toLowerCase() | ||
: opt.priority; | ||
switch (priority) { | ||
case 'low': | ||
str += '; Priority=Low'; | ||
break | ||
case 'medium': | ||
str += '; Priority=Medium'; | ||
break | ||
case 'high': | ||
str += '; Priority=High'; | ||
break | ||
default: | ||
throw new TypeError('option priority is invalid') | ||
} | ||
} | ||
if (opt.sameSite) { | ||
var sameSite = typeof opt.sameSite === 'string' | ||
? opt.sameSite.toLowerCase() : opt.sameSite; | ||
switch (sameSite) { | ||
case true: | ||
str += '; SameSite=Strict'; | ||
break; | ||
case 'lax': | ||
str += '; SameSite=Lax'; | ||
break; | ||
case 'strict': | ||
str += '; SameSite=Strict'; | ||
break; | ||
case 'none': | ||
str += '; SameSite=None'; | ||
break; | ||
default: | ||
throw new TypeError('option sameSite is invalid'); | ||
} | ||
} | ||
return str; | ||
} | ||
/** | ||
* URL-decode string value. Optimized to skip native call when no %. | ||
* | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function decode (str) { | ||
return str.indexOf('%') !== -1 | ||
? decodeURIComponent(str) | ||
: str | ||
} | ||
/** | ||
* URL-encode value. | ||
* | ||
* @param {string} val | ||
* @returns {string} | ||
*/ | ||
function encode (val) { | ||
return encodeURIComponent(val) | ||
} | ||
/** | ||
* Determine if value is a Date. | ||
* | ||
* @param {*} val | ||
* @private | ||
*/ | ||
function isDate (val) { | ||
return __toString.call(val) === '[object Date]' || | ||
val instanceof Date | ||
} | ||
/** | ||
* Try decoding a string using a decoding function. | ||
* | ||
* @param {string} str | ||
* @param {function} decode | ||
* @private | ||
*/ | ||
function tryDecode(str, decode) { | ||
try { | ||
return decode(str); | ||
} catch (e) { | ||
return str; | ||
} | ||
} | ||
var utils = {}; | ||
Object.defineProperty(utils, "__esModule", { | ||
value: true | ||
}); | ||
utils.cleanCookies = cleanCookies; | ||
utils.hasDocumentCookie = hasDocumentCookie; | ||
utils.parseCookies = parseCookies; | ||
utils.readCookie = readCookie; | ||
var cookie = _interopRequireWildcard(cookie$1); | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function hasDocumentCookie() { | ||
var testingValue = typeof commonjsGlobal === 'undefined' ? undefined : commonjsGlobal.TEST_HAS_DOCUMENT_COOKIE; | ||
if (typeof testingValue === 'boolean') { | ||
return testingValue; | ||
} | ||
// Can we get/set cookies on document.cookie? | ||
return (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && typeof document.cookie === 'string'; | ||
} | ||
function cleanCookies() { | ||
document.cookie.split(';').forEach(function (c) { | ||
document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/'); | ||
}); | ||
} | ||
function parseCookies(cookies) { | ||
if (typeof cookies === 'string') { | ||
return cookie.parse(cookies); | ||
} else if (_typeof(cookies) === 'object' && cookies !== null) { | ||
return cookies; | ||
} else { | ||
return {}; | ||
} | ||
} | ||
function readCookie(value) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var cleanValue = cleanupCookieValue(value); | ||
if (!options.doNotParse) { | ||
try { | ||
return JSON.parse(cleanValue); | ||
} catch (e) { | ||
// At least we tried | ||
} | ||
} | ||
// Ignore clean value if we failed the deserialization | ||
// It is not relevant anymore to trim those values | ||
return value; | ||
} | ||
function cleanupCookieValue(value) { | ||
// express prepend j: before serializing a cookie | ||
if (value && value[0] === 'j' && value[1] === ':') { | ||
return value.substr(2); | ||
} | ||
return value; | ||
} | ||
(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var cookie = _interopRequireWildcard(cookie$1); | ||
var _utils = utils; | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
exports["default"] = /*#__PURE__*/function () { | ||
function Cookies(cookies) { | ||
var _this = this; | ||
var defaultSetOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
_classCallCheck(this, Cookies); | ||
this.changeListeners = []; | ||
this.HAS_DOCUMENT_COOKIE = false; | ||
this.update = function () { | ||
if (!_this.HAS_DOCUMENT_COOKIE) { | ||
return; | ||
} | ||
var previousCookies = _this.cookies; | ||
_this.cookies = cookie.parse(document.cookie); | ||
_this._checkChanges(previousCookies); | ||
}; | ||
var domCookies = typeof document === 'undefined' ? '' : document.cookie; | ||
this.cookies = (0, _utils.parseCookies)(cookies || domCookies); | ||
this.defaultSetOptions = defaultSetOptions; | ||
this.HAS_DOCUMENT_COOKIE = (0, _utils.hasDocumentCookie)(); | ||
} | ||
_createClass(Cookies, [{ | ||
key: "_emitChange", | ||
value: function _emitChange(params) { | ||
for (var i = 0; i < this.changeListeners.length; ++i) { | ||
this.changeListeners[i](params); | ||
} | ||
} | ||
}, { | ||
key: "_checkChanges", | ||
value: function _checkChanges(previousCookies) { | ||
var _this2 = this; | ||
var names = new Set(Object.keys(previousCookies).concat(Object.keys(this.cookies))); | ||
names.forEach(function (name) { | ||
if (previousCookies[name] !== _this2.cookies[name]) { | ||
_this2._emitChange({ | ||
name: name, | ||
value: (0, _utils.readCookie)(_this2.cookies[name]) | ||
}); | ||
} | ||
}); | ||
} | ||
}, { | ||
key: "_startPolling", | ||
value: function _startPolling() { | ||
this.pollingInterval = setInterval(this.update, 300); | ||
} | ||
}, { | ||
key: "_stopPolling", | ||
value: function _stopPolling() { | ||
if (this.pollingInterval) { | ||
clearInterval(this.pollingInterval); | ||
} | ||
} | ||
}, { | ||
key: "get", | ||
value: function get(name) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (!options.doNotUpdate) { | ||
this.update(); | ||
} | ||
return (0, _utils.readCookie)(this.cookies[name], options); | ||
} | ||
}, { | ||
key: "getAll", | ||
value: function getAll() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
if (!options.doNotUpdate) { | ||
this.update(); | ||
} | ||
var result = {}; | ||
for (var name in this.cookies) { | ||
result[name] = (0, _utils.readCookie)(this.cookies[name], options); | ||
} | ||
return result; | ||
} | ||
}, { | ||
key: "set", | ||
value: function set(name, value, options) { | ||
if (options) { | ||
options = Object.assign(Object.assign({}, this.defaultSetOptions), options); | ||
} else { | ||
options = this.defaultSetOptions; | ||
} | ||
var stringValue = typeof value === 'string' ? value : JSON.stringify(value); | ||
this.cookies = Object.assign(Object.assign({}, this.cookies), _defineProperty({}, name, stringValue)); | ||
if (this.HAS_DOCUMENT_COOKIE) { | ||
document.cookie = cookie.serialize(name, stringValue, options); | ||
} | ||
this._emitChange({ | ||
name: name, | ||
value: value, | ||
options: options | ||
}); | ||
} | ||
}, { | ||
key: "remove", | ||
value: function remove(name, options) { | ||
var finalOptions = options = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), options), { | ||
expires: new Date(1970, 1, 1, 0, 0, 1), | ||
maxAge: 0 | ||
}); | ||
this.cookies = Object.assign({}, this.cookies); | ||
delete this.cookies[name]; | ||
if (this.HAS_DOCUMENT_COOKIE) { | ||
document.cookie = cookie.serialize(name, '', finalOptions); | ||
} | ||
this._emitChange({ | ||
name: name, | ||
value: undefined, | ||
options: options | ||
}); | ||
} | ||
}, { | ||
key: "addChangeListener", | ||
value: function addChangeListener(callback) { | ||
this.changeListeners.push(callback); | ||
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1) { | ||
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && 'cookieStore' in window) { | ||
window.cookieStore.addEventListener('change', this.update); | ||
} else { | ||
this._startPolling(); | ||
} | ||
} | ||
} | ||
}, { | ||
key: "removeChangeListener", | ||
value: function removeChangeListener(callback) { | ||
var idx = this.changeListeners.indexOf(callback); | ||
if (idx >= 0) { | ||
this.changeListeners.splice(idx, 1); | ||
} | ||
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0) { | ||
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && 'cookieStore' in window) { | ||
window.cookieStore.removeEventListener('change', this.update); | ||
} else { | ||
this._stopPolling(); | ||
} | ||
} | ||
} | ||
}]); | ||
return Cookies; | ||
}(); | ||
module.exports = exports.default; | ||
} (Cookies, Cookies.exports)); | ||
var CookiesExports = Cookies.exports; | ||
var types = {}; | ||
Object.defineProperty(types, "__esModule", { | ||
value: true | ||
}); | ||
(function (exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _exportNames = {}; | ||
exports["default"] = void 0; | ||
var _Cookies = _interopRequireDefault(CookiesExports); | ||
var _types = types; | ||
Object.keys(_types).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _types[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _types[key]; | ||
} | ||
}); | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
exports["default"] = _Cookies["default"]; | ||
} (cjs)); | ||
var index = /*@__PURE__*/getDefaultExportFromCjs(cjs); | ||
return index; | ||
})); |
@@ -1,8 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).UniversalCookie=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n={},o={exports:{}},i={ | ||
/*! | ||
* cookie | ||
* Copyright(c) 2012-2014 Roman Shtylman | ||
* Copyright(c) 2015 Douglas Christopher Wilson | ||
* MIT Licensed | ||
*/ | ||
parse:function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");var n={},o=(t||{}).decode||s,i=0;for(;i<e.length;){var r=e.indexOf("=",i);if(-1===r)break;var a=e.indexOf(";",i);if(-1===a)a=e.length;else if(a<r){i=e.lastIndexOf(";",r-1)+1;continue}var u=e.slice(i,r).trim();if(void 0===n[u]){var f=e.slice(r+1,a).trim();34===f.charCodeAt(0)&&(f=f.slice(1,-1)),n[u]=c(f,o)}i=a+1}return n},serialize:function(e,t,n){var o=n||{},i=o.encode||u;if("function"!=typeof i)throw new TypeError("option encode is invalid");if(!a.test(e))throw new TypeError("argument name is invalid");var s=i(t);if(s&&!a.test(s))throw new TypeError("argument val is invalid");var c=e+"="+s;if(null!=o.maxAge){var f=o.maxAge-0;if(isNaN(f)||!isFinite(f))throw new TypeError("option maxAge is invalid");c+="; Max-Age="+Math.floor(f)}if(o.domain){if(!a.test(o.domain))throw new TypeError("option domain is invalid");c+="; Domain="+o.domain}if(o.path){if(!a.test(o.path))throw new TypeError("option path is invalid");c+="; Path="+o.path}if(o.expires){var l=o.expires;if(!function(e){return"[object Date]"===r.call(e)||e instanceof Date}(l)||isNaN(l.valueOf()))throw new TypeError("option expires is invalid");c+="; Expires="+l.toUTCString()}o.httpOnly&&(c+="; HttpOnly");o.secure&&(c+="; Secure");o.partitioned&&(c+="; Partitioned");if(o.priority){switch("string"==typeof o.priority?o.priority.toLowerCase():o.priority){case"low":c+="; Priority=Low";break;case"medium":c+="; Priority=Medium";break;case"high":c+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(o.sameSite){switch("string"==typeof o.sameSite?o.sameSite.toLowerCase():o.sameSite){case!0:c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"strict":c+="; SameSite=Strict";break;case"none":c+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return c}},r=Object.prototype.toString,a=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function s(e){return-1!==e.indexOf("%")?decodeURIComponent(e):e}function u(e){return encodeURIComponent(e)}function c(e,t){try{return t(e)}catch(t){return e}}var f={};Object.defineProperty(f,"__esModule",{value:!0}),f.cleanCookies=function(){document.cookie.split(";").forEach((function(e){document.cookie=e.replace(/^ +/,"").replace(/=.*/,"=;expires="+(new Date).toUTCString()+";path=/")}))},f.hasDocumentCookie=function(){var t=void 0===e?void 0:e.TEST_HAS_DOCUMENT_COOKIE;if("boolean"==typeof t)return t;return"object"===("undefined"==typeof document?"undefined":d(document))&&"string"==typeof document.cookie},f.parseCookies=function(e){return"string"==typeof e?l.parse(e):"object"===d(e)&&null!==e?e:{}},f.readCookie=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(!t.doNotParse)try{return JSON.parse(n)}catch(e){}return e};var l=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=d(e)&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var a=i?Object.getOwnPropertyDescriptor(e,r):null;a&&(a.get||a.set)?Object.defineProperty(o,r,a):o[r]=e[r]}return o.default=e,n&&n.set(e,o),o}(i);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=a(e)&&"function"!=typeof e)return{default:e};var n=r(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var u=i?Object.getOwnPropertyDescriptor(e,s):null;u&&(u.get||u.set)?Object.defineProperty(o,s,u):o[s]=e[s]}return o.default=e,n&&n.set(e,o),o}(i),o=f;function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(r=function(e){return e?n:t})(e)}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,u(o.key),o)}}function u(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=a(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==a(t)?t:String(t)}t.default=function(){function e(t){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=function(){if(i.HAS_DOCUMENT_COOKIE){var e=i.cookies;i.cookies=n.parse(document.cookie),i._checkChanges(e)}};var a="undefined"==typeof document?"":document.cookie;this.cookies=(0,o.parseCookies)(t||a),this.defaultSetOptions=r,this.HAS_DOCUMENT_COOKIE=(0,o.hasDocumentCookie)()}var t,i,r;return t=e,i=[{key:"_emitChange",value:function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)}},{key:"_checkChanges",value:function(e){var t=this;new Set(Object.keys(e).concat(Object.keys(this.cookies))).forEach((function(n){e[n]!==t.cookies[n]&&t._emitChange({name:n,value:(0,o.readCookie)(t.cookies[n])})}))}},{key:"_startPolling",value:function(){this.pollingInterval=setInterval(this.update,300)}},{key:"_stopPolling",value:function(){this.pollingInterval&&clearInterval(this.pollingInterval)}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.doNotUpdate||this.update(),(0,o.readCookie)(this.cookies[e],t)}},{key:"getAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.doNotUpdate||this.update();var t={};for(var n in this.cookies)t[n]=(0,o.readCookie)(this.cookies[n],e);return t}},{key:"set",value:function(e,t,o){o=o?Object.assign(Object.assign({},this.defaultSetOptions),o):this.defaultSetOptions;var i="string"==typeof t?t:JSON.stringify(t);this.cookies=Object.assign(Object.assign({},this.cookies),function(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},e,i)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=n.serialize(e,i,o)),this._emitChange({name:e,value:t,options:o})}},{key:"remove",value:function(e,t){var o=t=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=n.serialize(e,"",o)),this._emitChange({name:e,value:void 0,options:t})}},{key:"addChangeListener",value:function(e){this.changeListeners.push(e),this.HAS_DOCUMENT_COOKIE&&1===this.changeListeners.length&&("object"===("undefined"==typeof window?"undefined":a(window))&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}},{key:"removeChangeListener",value:function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1),this.HAS_DOCUMENT_COOKIE&&0===this.changeListeners.length&&("object"===("undefined"==typeof window?"undefined":a(window))&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}}],i&&s(t.prototype,i),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),e.exports=t.default}(o,o.exports);var h=o.exports,y={};return Object.defineProperty(y,"__esModule",{value:!0}),function(e){Object.defineProperty(e,"__esModule",{value:!0});var t={};e.default=void 0;var n,o=(n=h)&&n.__esModule?n:{default:n},i=y;Object.keys(i).forEach((function(n){"default"!==n&&"__esModule"!==n&&(Object.prototype.hasOwnProperty.call(t,n)||n in e&&e[n]===i[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return i[n]}}))})),e.default=o.default}(n),t(n)})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("cookie")):"function"==typeof define&&define.amd?define(["cookie"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).UniversalCookie=t(e.cookie)}(this,(function(e){"use strict";function t(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var i=t(e);function o(e,t={}){const i=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(!t.doNotParse)try{return JSON.parse(i)}catch(e){}return e}return class{constructor(e,t={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const e=this.cookies;this.cookies=i.parse(document.cookie),this._checkChanges(e)};const o="undefined"==typeof document?"":document.cookie;this.cookies=function(e){return"string"==typeof e?i.parse(e):"object"==typeof e&&null!==e?e:{}}(e||o),this.defaultSetOptions=t,this.HAS_DOCUMENT_COOKIE=function(){const e="undefined"==typeof global?void 0:global.TEST_HAS_DOCUMENT_COOKIE;return"boolean"==typeof e?e:"object"==typeof document&&"string"==typeof document.cookie}()}_emitChange(e){for(let t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)}_checkChanges(e){new Set(Object.keys(e).concat(Object.keys(this.cookies))).forEach((t=>{e[t]!==this.cookies[t]&&this._emitChange({name:t,value:o(this.cookies[t])})}))}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(e,t={}){return t.doNotUpdate||this.update(),o(this.cookies[e],t)}getAll(e={}){e.doNotUpdate||this.update();const t={};for(let i in this.cookies)t[i]=o(this.cookies[i],e);return t}set(e,t,o){o=o?Object.assign(Object.assign({},this.defaultSetOptions),o):this.defaultSetOptions;const s="string"==typeof t?t:JSON.stringify(t);this.cookies=Object.assign(Object.assign({},this.cookies),{[e]:s}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=i.serialize(e,s,o)),this._emitChange({name:e,value:t,options:o})}remove(e,t){const o=t=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=i.serialize(e,"",o)),this._emitChange({name:e,value:void 0,options:t})}addChangeListener(e){this.changeListeners.push(e),this.HAS_DOCUMENT_COOKIE&&1===this.changeListeners.length&&("object"==typeof window&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(e){const t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1),this.HAS_DOCUMENT_COOKIE&&0===this.changeListeners.length&&("object"==typeof window&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}}})); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
33078
20
653
1
1