{"size": 899, "ext": "js", "max_stars_repo_path": "src/libs/geocenter.js", "max_stars_repo_name": "CezaryOrange/MML", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/libs/geocenter.js", "max_issues_repo_name": "CezaryOrange/MML", "max_issues_repo_issues_event_min_datetime": "2021-06-22T10:25:42.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-22T10:25:42.000Z", "max_forks_repo_path": "src/libs/geocenter.js", "max_forks_repo_name": "CezaryOrange/MML", "max_forks_repo_forks_event_min_datetime": "2021-06-22T09:52:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-22T09:52:21.000Z"}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 28.09375, "max_line_length": 85, "alphanum_fraction": 0.6440489433}
/*
 * Copyright (C) 2018 - 2019 Orange
 * 
 * This software is distributed under the terms and conditions of the 'MIT'
 * license which can be found in the file 'LICENSE.txt' in this package distribution 
 * or at https://spdx.org/licenses/MIT
 *
 */

 /* Orange contributed module for use on CozyCloud platform
 * 
 * Module name: MML - Mapping My Life
 * Version:     1.0.5
 * Created:     2018 by Orange
 */


module.exports = (points) => {
  points = points || []
  let {latitude, longitude} = points.reduce((agg, item) => {
    agg.latitude += item.latitude
    agg.longitude += item.longitude
    return agg
  }, {latitude: 0, longitude: 0 })
  if (latitude && latitude !== 0 && longitude && longitude !== 0) {
    // TODO: it may be ugly for react app to do that.
    return [latitude / points.length, longitude / points.length]
  }
  // error, go to Paris !
  return [48.866667, 2.333333]
}
