lib/ViewModels/GazetteerSearchProviderViewModel.js
function stripDuplicates(results) {
  var i;
  var placeshash = {};
  var stripped = [];
  for (i = 0; i < results.length; i++) {
    var lat = Number(results[i].location.split(",")[0]).toFixed(1);
    var lng = Number(results[i].location.split(",")[1]).toFixed(1);

    var hash = results[i].name + "_" + lat + " " + lng;
    if (!defined(placeshash[hash])) {
      placeshash[hash] = results[i];
      stripped.push(results[i]);
    }
  }
  return stripped;
}
function stripDuplicates(results) {
  var i;
  var placeshash = {};
  var stripped = [];
  for (i = 0; i < results.length; i++) {
    var lat = Number(results[i].location.split(",")[0]).toFixed(1);
    var lng = Number(results[i].location.split(",")[1]).toFixed(1);

    var hash = results[i].name + "_" + lat + " " + lng;
    if (!defined(placeshash[hash])) {
      placeshash[hash] = results[i];
      stripped.push(results[i]);
    }
  }
  return stripped;
}
function stripDuplicates ( results ) { var i ; var placeshash = { } ; var stripped = [ ] ; for ( i = 0 ; i < results . length ; i ++ ) { var lat = Number ( results [ i ] . location . split ( "," ) [ 0 ] ) . toFixed ( 1 ) ; var lng = Number ( results [ i ] . location . split ( "," ) [ 1 ] ) . toFixed ( 1 ) ; var hash = results [ i ] . name + "_" + lat + " " + lng ; if ( ! defined ( placeshash [ hash ] ) ) { placeshash [ hash ] = results [ i ] ; stripped . push ( results [ i ] ) ; } } return stripped ; }
Given a list of results sorted in decreasing importance, strip results that are close to another result with the same name
Given a list of results sorted in decreasing importance strip results that are close to another result with the same name