fix Ox.isEqual(-0, +0), update tests

This commit is contained in:
rolux 2012-05-27 18:59:40 +02:00
parent 8612218011
commit 45942cc3f2
2 changed files with 6 additions and 4 deletions

View file

@ -142,7 +142,7 @@
/*@
Ox.getLatLngByXY <f> Returns lat/lng for a given x/y on a 1x1 mercator projection
> Ox.getLatLngByXY({x: 0.5, y: 0.5})
{lat: 0, lng: 0}
{lat: -0, lng: 0}
@*/
Ox.getLatLngByXY = function(xy) {
function getValue(value) {

View file

@ -111,6 +111,8 @@ Ox.isEqual <function> Returns true if two values are equal
false
> Ox.isEqual(0, 0)
true
> Ox.isEqual(-0, +0)
false
> Ox.isEqual({}, {})
true
> Ox.isEqual({a: 1, b: 2, c: 3}, {c: 3, b: 2, a: 1})
@ -128,9 +130,9 @@ Ox.isEqual <function> Returns true if two values are equal
@*/
Ox.isEqual = function(a, b) {
var ret = false, type = Ox.typeOf(a);
if (a === b) {
// 0 === -0, but not equal
if (a === b && (a !== 0 || 1 / a === 1 / b)) {
ret = true;
ret = a !== 0 || 1 / a === 1 / b;
} else if (type == Ox.typeOf(b)) {
if (a == b) {
ret = true;