I have to center a polyline of a route, the route can have multiple coordinate points and look like this:

It sort of starts and finishes in the same point so I have to find the farthest coordinate (loop through the coordinates and calculate their distances) and do fitBounds(firstPoint, farthestPoint), it would be awesome if fitBounds would accept an array and center everything by its own.
@nitaliano: if it's not possible, do you have any suggestion on how to do this faster?
My solution didn't work for some cases with strange routes, ended up using bound-points which works nice!
For general geo processing, I'd recommend Turf JS. In this particular case, bbox or bbox-polygon would also have solved your issue.
@lucasbento you should use turfjs for this you can think of it as underscore for anything geo related. It's highly optimized and using turf means you can share code between mobile and web.
These are quick links to the two functions that @kristfal described above that will be able to solve this issue for you.
http://turfjs.org/docs#bbox
http://turfjs.org/docs#bboxPolygon
Most helpful comment
@lucasbento you should use turfjs for this you can think of it as underscore for anything geo related. It's highly optimized and using turf means you can share code between mobile and web.
These are quick links to the two functions that @kristfal described above that will be able to solve this issue for you.
http://turfjs.org/docs#bbox
http://turfjs.org/docs#bboxPolygon