Preserve type for numeric values #57

Merged
merged 3 commits into from Oct 3, 2012

Projects

None yet

2 participants

@privman
Contributor
privman commented Sep 28, 2012

I had a type mismatch problem: stored numeric values where retrieved as strings. This commit fixes the issue by utilising the 3rd flag bit to indicate a numeric value.

@3rd-Eden 3rd-Eden commented on an outdated diff Oct 1, 2012
lib/memcached.js
@@ -411,6 +412,9 @@ Client.config = {
case FLAG_JSON:
dataSet = JSON.parse(dataSet);
break;
+ case FLAG_NUMERIC:
+ dataSet = parseFloat(dataSet);
3rd-Eden
3rd-Eden Oct 1, 2012 Owner

could you change this to dataSet = +dataSet looks good otherwise.

Owner
3rd-Eden commented Oct 1, 2012

Thanks for the pull request, it looks good to me. Could you a simple test for this?

Contributor
privman commented Oct 3, 2012

I applied the change you suggested and updated an existing test to take the change into account. Unfortunately I haven't been able to build the tests on my (Windows) machine to verify the change. Hope it works :)

Owner
3rd-Eden commented Oct 3, 2012

All tests seem to pass here, thanks a lot for your contribution! I really appreciate it!

@3rd-Eden 3rd-Eden merged commit d1c0afd into 3rd-Eden:master Oct 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment