mapbox / mapbox-sdk-js

A JavaScript client to Mapbox services, supporting Node, browsers, and React Native
Other
718 stars 186 forks source link

Fixes #412 #413

Closed jjavery closed 3 years ago

jjavery commented 3 years ago

Array.prototype.reverse() reverses an array in place. This results in the unintended mutation of the coordinates property of encodePathOverlay()'s o (overlay) param. See a side-effect of this mutation in #412.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse

Instead, create a new array and initialize it with the reversed lat and long.