Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set cookie "1.0", it returns 1 instead of "1.0" #30

Open
JobaDiniz opened this issue Aug 22, 2014 · 1 comment
Open

Set cookie "1.0", it returns 1 instead of "1.0" #30

JobaDiniz opened this issue Aug 22, 2014 · 1 comment

Comments

@JobaDiniz
Copy link
Contributor

I set a string containing "1.0" and it treats like a number, but it should be string.

Plunker: http://plnkr.co/edit/LKDa49lsomvHGMaycWtE

  1. Click "Set Cookie"
  2. Click "Get Cookie"
  3. Check the last item showed. It should be "1.0"
@bmnielsen
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants