<commit_before>angular.module('secret', ['ngRoute'])
  .config(($routeProvider) => {
    $routeProvider
      .when('/map', {
        controller: 'mapCtrl',
        controllerAs: 'map',
        templateUrl: 'content/map.html'
      })
      .otherwise('/')
  })


  // Establishing a constant for the API URL
  .constant('API_URL', 'https://maps.googleapis.com/maps/api/directions/json?' )
  // Establishing a constant for the Firebase API
  .constant('firebase_URL', 'https://the-secret-path.firebaseio.com/')


  .controller('MainCtrl', function($scope, $timeout, googleFactory) {
    const main = this;

    $scope.user = '';
    $scope.map = null;

    // Taking User starting & ending points, triggering API request
    main.locations = function () {
      let startPlus = $scope.user.starting.split(' ').join('+')
      let endPlus = $scope.user.ending.split(' ').join('+')
      console.log("type startPlus =", startPlus);
      console.log("type endPlus =", endPlus);
      googleFactory.getDirections(startPlus, endPlus)
        .then((response) => main.initialize(response))
    };

    main.initialize = function (response) {
      directionsDisplay = new google.maps.DirectionsRenderer(response);
      console.log("map center?",response)
      var mapOptions = {
        zoom:7,
        center: {lat: response.data.routes[0].legs[0].start_location.lat, lng: response.data.routes[0].legs[0].start_location.lng},
      }
      map = new google.maps.Map(document.getElementById("map"), mapOptions);
      directionsDisplay.setMap(map);
      main.calcRoute();
    }

    main.calcRoute = function () {
      var start = $scope.user.starting;
      var end = $scope.user.ending;
      var request = {
        origin:start,
        destination:end,
        travelMode: google.maps.TravelMode.DRIVING
      };
      directionsService.route(request, function(result, status) {
        if (status == google.maps.DirectionsStatus.OK) {
          directionsDisplay.setDirections(result);
        }
      });
    }

    let map = null;
    navigator.geolocation.getCurrentPosition(initMap);

    // Initilizing Google Map
    function initMap (userPosition) {
      var mapDiv = document.getElementById('map');
      console.log('user position', userPosition);
      map = new google.maps.Map(mapDiv, {
        center: {lat: userPosition.coords.latitude, lng: userPosition.coords.longitude},
        zoom: 9
      })
      console.log("map data", map.data)
    }

    let directionsDisplay;
    let directionsService = new google.maps.DirectionsService();
  })


// firebase.initializeApp({
//     apiKey: "<KEY>",
//     authDomain: "the-secret-path.firebaseapp.com",
//     databaseURL: "https://the-secret-path.firebaseio.com",
//     storageBucket: "the-secret-path.appspot.com",
//   })

<commit_msg>add minor edits to main.js<commit_after>angular.module('secret', ['ngRoute'])
  .config(($routeProvider) => {
    $routeProvider
      .when('/map', {
        controller: 'mapCtrl',
        controllerAs: 'map',
        templateUrl: 'content/map.html'
      })
      .otherwise('/')
  })


  // Establishing a constant for the API URL
  .constant('API_URL', 'https://maps.googleapis.com/maps/api/directions/json?' )
  // Establishing a constant for the Firebase API
  .constant('firebase_URL', 'https://the-secret-path.firebaseio.com/')

  .controller('MainCtrl', function($scope, $timeout, googleFactory) {
    const main = this;

    $scope.user = '';
    $scope.map = null;

    // Taking user starting & ending points, triggering API request
    main.locations = function () {
      let startPlus = $scope.user.starting.split(' ').join('+')
      let endPlus = $scope.user.ending.split(' ').join('+')
      console.log("type startPlus =", startPlus);
      console.log("type endPlus =", endPlus);
      googleFactory.getDirections(startPlus, endPlus)
        .then((response) => main.initialize(response))
    };

    // Initializing loading map with user's current position as center
    main.initialize = function (response) {
      directionsDisplay = new google.maps.DirectionsRenderer(response);
      console.log("map center?",response)
      var mapOptions = {
        zoom:7,
        center: {lat: response.data.routes[0].legs[0].start_location.lat, lng: response.data.routes[0].legs[0].start_location.lng},
      }
      map = new google.maps.Map(document.getElementById("map"), mapOptions);
      directionsDisplay.setMap(map);
      main.calcRoute();
    }

    //Calculating directions from user input
    main.calcRoute = function () {
      var start = $scope.user.starting;
      var end = $scope.user.ending;
      var request = {
        origin:start,
        destination:end,
        travelMode: google.maps.TravelMode.DRIVING
      };
      directionsService.route(request, function(result, status) {
        if (status == google.maps.DirectionsStatus.OK) {
          directionsDisplay.setDirections(result);
        }
      });
    }

    let map = null;

    // Finding user's current position
    navigator.geolocation.getCurrentPosition(initMap);

    // Initilizing Google Map
    function initMap (userPosition) {
      var mapDiv = document.getElementById('map');
      console.log('user position', userPosition);
      map = new google.maps.Map(mapDiv, {
        center: {lat: userPosition.coords.latitude, lng: userPosition.coords.longitude},
        zoom: 9
      })
      console.log("map data", map.data)
    }

    let directionsDisplay;
    let directionsService = new google.maps.DirectionsService();
  })


// firebase.initializeApp({
//     apiKey: "<KEY>",
//     authDomain: "the-secret-path.firebaseapp.com",
//     databaseURL: "https://the-secret-path.firebaseio.com",
//     storageBucket: "the-secret-path.appspot.<EMAIL>",
//   })


{'fraction_non_alphanumeric': 0.14638783269961977, 'fraction_numerical': 0.002073971655720705, 'mean_word_length': 2.8426294820717133, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3254493', 'n_tokens_mistral': 1758, 'n_tokens_neox': 1710, 'n_words': 332}