Closed dawsbot closed 6 years ago
Correct, browser-cookies only allows a string as cookie value. The API description for cookies.set() currently has the following description:
argument | type | description |
---|---|---|
value |
string | The value to save, percent encoding will automatically be applied. |
I'm proposing to extend the description to explicitly mention only strings are allowed as a value. As for the JSON example in your comment the examples section shows how to save JSON data, I can also refer to this example in the API documentation.
Thanks for the info, this makes sense. We ended up relying on js-cookie
, it's a similar bundle size, and heavily used/tested.
It looks like this strictly allows
string
s as the "value
", is this true? That should be documented somewhere, it's misleading.Test by pasting this page content directly in your browser console: https://wzrd.in/standalone/browser-cookies@latest