Refactoring: L.latLng factory to call constructor with explicit arguments number

This commit is contained in:
Sergey Kruk 2014-12-06 15:32:22 +03:00
parent c8e5d7c61b
commit 65cc3c813b

View File

@ -61,9 +61,12 @@ L.latLng = function (a, b, c) {
return a;
}
if (L.Util.isArray(a) && typeof a[0] !== 'object') {
if (a.length >= 2) {
if (a.length === 3) {
return new L.LatLng(a[0], a[1], a[2]);
}
if (a.length === 2) {
return new L.LatLng(a[0], a[1]);
}
return null;
}
if (a === undefined || a === null) {