(a, b, c)
| 1553 | // Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead. |
| 1554 | |
| 1555 | function toLatLng(a, b, c) { |
| 1556 | if (a instanceof LatLng) { |
| 1557 | return a; |
| 1558 | } |
| 1559 | if (isArray(a) && typeof a[0] !== 'object') { |
| 1560 | if (a.length === 3) { |
| 1561 | return new LatLng(a[0], a[1], a[2]); |
| 1562 | } |
| 1563 | if (a.length === 2) { |
| 1564 | return new LatLng(a[0], a[1]); |
| 1565 | } |
| 1566 | return null; |
| 1567 | } |
| 1568 | if (a === undefined || a === null) { |
| 1569 | return a; |
| 1570 | } |
| 1571 | if (typeof a === 'object' && 'lat' in a) { |
| 1572 | return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt); |
| 1573 | } |
| 1574 | if (b === undefined) { |
| 1575 | return null; |
| 1576 | } |
| 1577 | return new LatLng(a, b, c); |
| 1578 | } |
| 1579 | |
| 1580 | /* |
| 1581 | * @namespace CRS |
no test coverage detected