js-cookie 3.0.3 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -38
- package/dist/js.cookie.js +1 -1
- package/dist/js.cookie.min.js +1 -1
- package/dist/js.cookie.min.mjs +1 -1
- package/dist/js.cookie.mjs +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -32,45 +32,11 @@ npm i js-cookie
|
|
|
32
32
|
|
|
33
33
|
The npm package has a `module` field pointing to an ES module variant of the library, mainly to provide support for ES module aware bundlers, whereas its `browser` field points to an UMD module for full backward compatibility.
|
|
34
34
|
|
|
35
|
-
### Direct download
|
|
36
|
-
|
|
37
|
-
Starting with version 3 [releases](https://github.com/js-cookie/js-cookie/releases) are distributed with two variants of this library, an ES module as well as an UMD module.
|
|
38
|
-
|
|
39
|
-
Note the different extensions: `.mjs` denotes the ES module, whereas `.js` is the UMD one.
|
|
40
|
-
|
|
41
|
-
Example for how to load the ES module in a browser:
|
|
42
|
-
|
|
43
|
-
```html
|
|
44
|
-
<script type="module" src="/path/to/js.cookie.mjs"></script>
|
|
45
|
-
<script type="module">
|
|
46
|
-
import Cookies from '/path/to/js.cookie.mjs'
|
|
47
|
-
|
|
48
|
-
Cookies.set('foo', 'bar')
|
|
49
|
-
</script>
|
|
50
|
-
```
|
|
51
|
-
|
|
52
35
|
_Not all browsers support ES modules natively yet_. For this reason the npm package/release provides both the ES and UMD module variant and you may want to include the ES module along with the UMD fallback to account for this:
|
|
53
36
|
|
|
54
|
-
```html
|
|
55
|
-
<script type="module" src="/path/to/js.cookie.mjs"></script>
|
|
56
|
-
<script nomodule defer src="/path/to/js.cookie.js"></script>
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Here we're loading the nomodule script in a deferred fashion, because ES modules are deferred by default. This may not be strictly necessary depending on how you're using the library.
|
|
60
|
-
|
|
61
37
|
### CDN
|
|
62
38
|
|
|
63
|
-
Alternatively, include
|
|
64
|
-
|
|
65
|
-
## ES Module
|
|
66
|
-
|
|
67
|
-
Example for how to import the ES module from another module:
|
|
68
|
-
|
|
69
|
-
```javascript
|
|
70
|
-
import Cookies from 'js-cookie'
|
|
71
|
-
|
|
72
|
-
Cookies.set('foo', 'bar')
|
|
73
|
-
```
|
|
39
|
+
Alternatively, include js-cookie via [jsDelivr CDN](https://www.jsdelivr.com/package/npm/js-cookie).
|
|
74
40
|
|
|
75
41
|
## Basic Usage
|
|
76
42
|
|
|
@@ -319,10 +285,10 @@ For vulnerability reports, send an e-mail to `js-cookie at googlegroups dot com`
|
|
|
319
285
|
|
|
320
286
|
## Releasing
|
|
321
287
|
|
|
322
|
-
|
|
288
|
+
Releasing should be done via the `Release` GitHub Actions workflow, so that published packages on npmjs.com have package provenance.
|
|
323
289
|
|
|
324
|
-
|
|
325
|
-
(This is so we are able to craft suitable release notes before publishing.)
|
|
290
|
+
GitHub releases are created as a draft and need to be published manually!
|
|
291
|
+
(This is so we are able to craft suitable release notes before publishing.)
|
|
326
292
|
|
|
327
293
|
## Supporters
|
|
328
294
|
|
package/dist/js.cookie.js
CHANGED
package/dist/js.cookie.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! js-cookie v3.0.
|
|
1
|
+
/*! js-cookie v3.0.5 | MIT */
|
|
2
2
|
!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,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,(function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var t=function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+c}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),c=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(o[u]=n.read(c,u),e===u)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});return t}));
|
package/dist/js.cookie.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! js-cookie v3.0.
|
|
1
|
+
/*! js-cookie v3.0.5 | MIT */
|
|
2
2
|
function e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var t=function t(r,n){function o(t,o,i){if("undefined"!=typeof document){"number"==typeof(i=e({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+r.write(o,t)+c}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],n={},o=0;o<t.length;o++){var i=t[o].split("="),c=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(n[u]=r.read(c,u),e===u)break}catch(e){}}return e?n[e]:n}},remove:function(t,r){o(t,"",e({},r,{expires:-1}))},withAttributes:function(r){return t(this.converter,e({},this.attributes,r))},withConverter:function(r){return t(e({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(r)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});export{t as default};
|
package/dist/js.cookie.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-cookie",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "A simple, lightweight JavaScript API for handling cookies",
|
|
5
5
|
"browser": "dist/js.cookie.js",
|
|
6
6
|
"module": "dist/js.cookie.mjs",
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
"standard": "^17.0.0"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
|
-
"node": ">=14"
|
|
70
|
-
"npm": ">=9.5.0"
|
|
69
|
+
"node": ">=14"
|
|
71
70
|
}
|
|
72
71
|
}
|