|
1 | | -/*! js-cookie v3.0.1 | MIT */ |
| 1 | +/*! js-cookie v3.0.5 | MIT */ |
2 | 2 | ; |
3 | 3 | (function (global, factory) { |
4 | 4 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : |
5 | 5 | typeof define === 'function' && define.amd ? define(factory) : |
6 | | - (global = global || self, (function () { |
| 6 | + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () { |
7 | 7 | var current = global.Cookies; |
8 | 8 | var exports = global.Cookies = factory(); |
9 | 9 | exports.noConflict = function () { global.Cookies = current; return exports; }; |
10 | | - }())); |
11 | | -}(this, (function () { 'use strict'; |
| 10 | + })()); |
| 11 | +})(this, (function () { 'use strict'; |
12 | 12 |
|
13 | 13 | /* eslint-disable no-var */ |
14 | 14 | function assign (target) { |
|
42 | 42 | /* eslint-disable no-var */ |
43 | 43 |
|
44 | 44 | function init (converter, defaultAttributes) { |
45 | | - function set (key, value, attributes) { |
| 45 | + function set (name, value, attributes) { |
46 | 46 | if (typeof document === 'undefined') { |
47 | 47 | return |
48 | 48 | } |
|
56 | 56 | attributes.expires = attributes.expires.toUTCString(); |
57 | 57 | } |
58 | 58 |
|
59 | | - key = encodeURIComponent(key) |
| 59 | + name = encodeURIComponent(name) |
60 | 60 | .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) |
61 | 61 | .replace(/[()]/g, escape); |
62 | 62 |
|
|
83 | 83 | } |
84 | 84 |
|
85 | 85 | return (document.cookie = |
86 | | - key + '=' + converter.write(value, key) + stringifiedAttributes) |
| 86 | + name + '=' + converter.write(value, name) + stringifiedAttributes) |
87 | 87 | } |
88 | 88 |
|
89 | | - function get (key) { |
90 | | - if (typeof document === 'undefined' || (arguments.length && !key)) { |
| 89 | + function get (name) { |
| 90 | + if (typeof document === 'undefined' || (arguments.length && !name)) { |
91 | 91 | return |
92 | 92 | } |
93 | 93 |
|
|
100 | 100 | var value = parts.slice(1).join('='); |
101 | 101 |
|
102 | 102 | try { |
103 | | - var foundKey = decodeURIComponent(parts[0]); |
104 | | - jar[foundKey] = converter.read(value, foundKey); |
| 103 | + var found = decodeURIComponent(parts[0]); |
| 104 | + jar[found] = converter.read(value, found); |
105 | 105 |
|
106 | | - if (key === foundKey) { |
| 106 | + if (name === found) { |
107 | 107 | break |
108 | 108 | } |
109 | 109 | } catch (e) {} |
110 | 110 | } |
111 | 111 |
|
112 | | - return key ? jar[key] : jar |
| 112 | + return name ? jar[name] : jar |
113 | 113 | } |
114 | 114 |
|
115 | 115 | return Object.create( |
116 | 116 | { |
117 | | - set: set, |
118 | | - get: get, |
119 | | - remove: function (key, attributes) { |
| 117 | + set, |
| 118 | + get, |
| 119 | + remove: function (name, attributes) { |
120 | 120 | set( |
121 | | - key, |
| 121 | + name, |
122 | 122 | '', |
123 | 123 | assign({}, attributes, { |
124 | 124 | expires: -1 |
|
144 | 144 |
|
145 | 145 | return api; |
146 | 146 |
|
147 | | -}))); |
| 147 | +})); |
0 commit comments