esri-leaflet-geocoder has error in both old and current version

esri-leaflet-geocoder has error in both old and current version

by Alexander Farber

HTML

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1/dist/leaflet.css">
<script src="https://cdn.jsdelivr.net/npm/leaflet@1/dist/leaflet-src.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-geosearch@3/dist/geosearch.css">
<script src="https://cdn.jsdelivr.net/npm/leaflet-geosearch@3/dist/bundle.min.js"></script>
<div id="mapId"></div>

CSS

html, body { 
  margin: 0;
  padding: 0;
}

#mapId {
  position: absolute;
  width: 100%;
  height: 100%;
}

JavaScript

'use strict';

var myMap = L.map('mapId').setView([40.730610,-73.935242], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  attribution: '&copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors'
}).addTo(myMap);

var search = new GeoSearch.GeoSearchControl({
  provider: new GeoSearch.OpenStreetMapProvider(),
  style: 'bar',
  showPopup: true,
  popupFormat: ({
      query,
      result
    }) =>
    result.label +
    ': longitude: ' + parseFloat(result.x).toFixed(6) +
    ', latitude: ' + parseFloat(result.y).toFixed(6)
});

myMap.addControl(search);