fix Ox.isEqual(-0, +0), update tests
This commit is contained in:
parent
8612218011
commit
45942cc3f2
2 changed files with 6 additions and 4 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
// 0 === -0, but not equal
|
||||
if (a === b && (a !== 0 || 1 / a === 1 / b)) {
|
||||
ret = true;
|
||||
if (a === b) {
|
||||
// 0 === -0, but not equal
|
||||
ret = a !== 0 || 1 / a === 1 / b;
|
||||
} else if (type == Ox.typeOf(b)) {
|
||||
if (a == b) {
|
||||
ret = true;
|
||||
|
|
Loading…
Reference in a new issue