Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.

Avoids mutating original object in arrayToLatLng #539

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions gmaps.js
Original file line number Diff line number Diff line change
@@ -102,20 +102,17 @@ var coordsToLatLngs = function(coords, useGeoJSON) {
};

var arrayToLatLng = function(coords, useGeoJSON) {
var i;

for (i = 0; i < coords.length; i++) {
if (!(coords[i] instanceof google.maps.LatLng)) {
if (coords[i].length > 0 && typeof(coords[i][0]) === "object") {
coords[i] = arrayToLatLng(coords[i], useGeoJSON);
}
else {
coords[i] = coordsToLatLngs(coords[i], useGeoJSON);
}
return array_map(coords, function(coord) {
if (coord instanceof google.maps.LatLng) {
return coord;
}
}

return coords;
if (coord.length > 0 && typeof(coord[0]) === 'object') {
return arrayToLatLng(coord, useGeoJSON);
}
else {
return coordsToLatLngs(coord, useGeoJSON);
}
});
};

var getElementsByClassName = function (class_name, context) {