angular-cookie
angular-cookie copied to clipboard
Set cookie "1.0", it returns 1 instead of "1.0"
I set a string containing "1.0" and it treats like a number, but it should be string.
Plunker: http://plnkr.co/edit/LKDa49lsomvHGMaycWtE
- Click "Set Cookie"
- Click "Get Cookie"
- Check the last item showed. It should be "1.0"
Yeah, it's running all values through a JSON.parse, which converts strings to numbers.
I'm having an issue where some of my strings coincidentally match the exponential format, e.g.
ipCookie('testCookie', "123581763871623871628361723e12341");
console.log(ipCookie('testCookie')); // Logs Infinity
The library is trying to do too much. Just store strings and let the user figure out serialization and deserialization.