Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Number comparison problem #110
Maybe i'm doing something wrong,
But when I run rule matching on this expression, matching fails
"79.00" == 79 .. in JSFiddle ofcourse this evaluates to true.
Rule matching is working for this however...
"79.00" <= 100 -> true
It seems like that number comparison maybe getting translated somewhere down the stack.
Nools uses a strict equals so your "79.00" will not
Well really what I"m passing in is
p.price == 79
so I can't really do: parseInt(p.price, 10 )
at that the same time, I'm not sure that loosening the strict matching is an answer either, people can run into issues if they don't know what they're doing.
Let me know where I should I look, and I can take a gander. Looks like some of this is happening in contraints.js ... i'm not sure I can follow it w/ out a sequence diagram or a specific instructions but I can look nonetheless.
Okay I got this working by a hack:
parseInt didn't work, but i was able to do this:
// p.price = '79.00'
(p.price * 1) == 79 // true
It makes sense that 'price' should be a float to begin with... but part of what I'm using Nools for is data normalization so its important that I get it working from the nools end. Anyway were good for now
Ok I added
I hope this helps.