Skip to content

Commit

Permalink
fix(parsing): allow parsing coordinate at 0,0 with x,y object input
Browse files Browse the repository at this point in the history
  • Loading branch information
evansiroky committed Dec 22, 2016
1 parent 3d38053 commit 0564148
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ function normalize (unknown) {
if (!unknown) throw new Error('Value must not be null or undefined.')
if (Array.isArray(unknown)) return fromCoordinates(unknown)
else if (typeof unknown === 'string') return fromString(unknown)
else if (unknown.x && unknown.y) return fromPoint(unknown)
else if ((unknown.x || unknown.x === 0) && (unknown.y || unknown.y === 0)) return fromPoint(unknown)
return floatize(unknown)
}
1 change: 1 addition & 0 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ describe('lonlat', () => {
describe('issues', () => {
it('#3 - Does not parse coordinates with 0 for lat or lon', () => {
expect(ll({ lat: 0, lng: 0 })).toEqual({ lat: 0, lon: 0 })
expect(ll({ x: 0, y: 0 })).toEqual({ lat: 0, lon: 0 })
})
})
})

0 comments on commit 0564148

Please sign in to comment.