ScottHamper / Cookies

JavaScript Client-Side Cookie Manipulation Library
The Unlicense
1.77k stars 170 forks source link

Support for sub-cookies #39

Closed fadetogrey closed 9 years ago

fadetogrey commented 9 years ago

Hello Scott, Would you consider supporting sub-cookies like the following? Cookies.set('key', 'subkey', 'value');

ScottHamper commented 9 years ago

Hey fadetogrey,

No, this is out of the scope of the library. If you'd like to somehow encode extra information into a single cookie value, I'd recommend using JSON.

Cookies.set('key', JSON.stringify({ subkey: 'value' }));
JSON.parse(Cookies.get('key')).subkey; // "value"