<commit_before>'use strict';

var logger = require('./logger');
var geolib = require('geolib');
var geocoder = require('geocoder');

function getDistance(a,b){
  return geolib.getDistance(a,b);
}

function reverseGeoCode(location,callback){
 geocoder.reverseGeocode( location.latitude , location.longitude , 
   function(err,data){
     if ( data && data.results && data.results[0] ){
       callback(' ('+data.results[0].formatted_address+')');
     }else{
       callback('');
     }
   });
}

function radians(degrees) {
  return degrees * Math.PI / 180;
};
 
function degrees(radians) {
  return radians * 180 / Math.PI;
};

function getBearing(start,target){
  var s = toRadians(start);
  var d = toRadians(target);
  var dLong  = d.longitiude - s.longitiude;
  var inner = 
      Math.tan(d.latitude/2.0+Math.PI/4.0)/
      Math.tan(s.latitude/2.0+Math.PI/4.0);
  var dPhi = Math.log(inner);
  if (Math.abs(dLong) > Math.PI ){
    if (dLong > 0.0)
      dLong = -2(2*Math.PI - dLong);
    else
      dLong = (2*Math.PI + dLong);
  }
  var bearing = degrees(Math.atan2(dLong,dPhi));
  return bearing;
}

var cardinals = ['N','NE','E','SE','S','SW','W','NW'];
function cardinalBearing(degrees){
  var degreesPerItem = 360 / cardinals.length;
  var option = (degrees + degreesPerItem*0.5) / degreesPerItem
  var index = Math.floor(option + cardinals.length ) % cardinals.length
  return cardinals[index];
}

function toRadians(a){
  return {
    latitude:radians(a.latitude),
    longitiude:radians(a.longitude)
  };
}

module.exports = {
  getDistance:getDistance,
  reverseGeoCode:reverseGeoCode,
  getBearing:getBearing,
  cardinalBearing:cardinalBearing
};<commit_msg>fix for typo<commit_after>'use strict';

var logger = require('./logger');
var geolib = require('geolib');
var geocoder = require('geocoder');

function getDistance(a,b){
  return geolib.getDistance(a,b);
}

function reverseGeoCode(location,callback){
 geocoder.reverseGeocode( location.latitude , location.longitude , 
   function(err,data){
     if ( data && data.results && data.results[0] ){
       callback(' ('+data.results[0].formatted_address+')');
     }else{
       callback('');
     }
   });
}

function radians(degrees) {
  return degrees * Math.PI / 180;
};
 
function degrees(radians) {
  return radians * 180 / Math.PI;
};

function getBearing(start,target){
  var s = toRadians(start);
  var d = toRadians(target);
  var dLong  = d.longitiude - s.longitiude;
  var inner = 
      Math.tan(d.latitude/2.0+Math.PI/4.0)/
      Math.tan(s.latitude/2.0+Math.PI/4.0);
  var dPhi = Math.log(inner);
  if (Math.abs(dLong) > Math.PI ){
    if (dLong > 0.0)
      dLong = -(2*Math.PI - dLong);
    else
      dLong = (2*Math.PI + dLong);
  }
  var bearing = degrees(Math.atan2(dLong,dPhi));
  return bearing;
}

var cardinals = ['N','NE','E','SE','S','SW','W','NW'];
function cardinalBearing(degrees){
  var degreesPerItem = 360 / cardinals.length;
  var option = (degrees + degreesPerItem*0.5) / degreesPerItem
  var index = Math.floor(option + cardinals.length ) % cardinals.length
  return cardinals[index];
}

function toRadians(a){
  return {
    latitude:radians(a.latitude),
    longitiude:radians(a.longitude)
  };
}

module.exports = {
  getDistance:getDistance,
  reverseGeoCode:reverseGeoCode,
  getBearing:getBearing,
  cardinalBearing:cardinalBearing
};
{'fraction_non_alphanumeric': 0.16129032258064516, 'fraction_numerical': 0.015830346475507767, 'mean_word_length': 3.818705035971223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '3116963', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1217, 'n_words': 220}