Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
js.cookie.js | 2021-07-26 | 4.2 kB | |
js.cookie.min.js | 2021-07-26 | 1.7 kB | |
js.cookie.min.mjs | 2021-07-26 | 1.4 kB | |
js.cookie.mjs | 2021-07-26 | 3.5 kB | |
README.md | 2021-07-26 | 2.3 kB | |
v3.0.0.tar.gz | 2021-07-26 | 22.4 kB | |
v3.0.0.zip | 2021-07-26 | 33.6 kB | |
Totals: 7 Items | 69.1 kB | 0 |
-
Removed
defaults
in favor of a builder: now to supply an api instance with particular predefined (cookie) attributes there'sCookies.withAttributes()
, e.g.::::js const api = Cookies.withAttributes({ path: '/', secure: true }) api.set('key', 'value') // writes cookie with path: '/' and secure: true... * The attributes that an api instance is configured with are exposed as
attributes
property; it's an immutable object and unlikedefaults
cannot be changed to configure the api. * The mechanism to fall back to the standard, internal converter by returning a falsy value in a custom read converter has been removed. Instead the default converters are now exposed asCookies.converter
, which allows for implementing self-contained custom converters providing the same behavior::::js const customReadConverter = (value, name) => { if (name === 'special') { return unescape(value) } return Cookies.converter.read(value) } *
withConverter()
no longer accepts a function as argument to be turned into a read converter. It is now required to always pass an object with the explicit type(s) of converter(s)::::js const api = Cookies.withConverter({ read: (value, name) => unescape(value) }) * The converter(s) that an api instance is configured with are exposed as
converter
property; it's an immutable object and cannot be changed to configure the api. * Started providing library as ES module, in addition to UMD module. Themodule
field inpackage.json
points to an ES module variant of the library. * Started usingbrowser
field instead ofmain
inpackage.json
(for the UMD variant of the library). * Dropped support for IE < 10. * Removed built-in JSON support, i.e.getJSON()
and automatic stringifying inset()
: useCookies.set('foo', JSON.stringify({ ... }))
andJSON.parse(Cookies.get('foo'))
instead. * Removed support for Bower. * Added minified versions to package - [#501] * Improved support for url encoded cookie values (support case insensitive encoding) - [#466], [#530] * Expose default path via API - [#541] * Handle falsy arguments passed to getters - [#399] * No longer support Node < 12 when building (LTS versions only)