diff --git a/src/SearchControl.ts b/src/SearchControl.ts index 9faaf15e..d7bda929 100644 --- a/src/SearchControl.ts +++ b/src/SearchControl.ts @@ -3,7 +3,6 @@ import { ControlPosition, FeatureGroup, MarkerOptions, Map } from 'leaflet'; import SearchElement from './SearchElement'; import ResultList from './resultList'; import debounce from './lib/debounce'; -import { validateCoords } from './coords'; import { createElement, @@ -374,13 +373,7 @@ const Control: SearchControl = { const { provider } = this.options; if (query.length) { - let results = []; - const coords = validateCoords(query); - if (coords) { - results = coords; - } else { - results = await provider!.search({ query }); - } + let results = await provider!.search({ query }); results = results.slice(0, this.options.maxSuggestions); this.resultList.render(results, this.options.resultFormat); } else { @@ -392,13 +385,7 @@ const Control: SearchControl = { this.resultList.clear(); const { provider } = this.options; - let results = []; - const coords = validateCoords(query); - if (coords) { - results = coords; - } else { - results = await provider!.search(query); - } + const results = await provider!.search(query); if (results && results.length > 0) { this.showResult(results[0], query); diff --git a/src/coords.ts b/src/coords.ts deleted file mode 100644 index e413608a..00000000 --- a/src/coords.ts +++ /dev/null @@ -1,23 +0,0 @@ -// @ts-nocheck - -export function validateCoords(query) { - const q = query?.trim(); - const regex = /^(-?[0-9]*\.?\s*[0-9]*)\s*,?\s*(-?[0-9]*\.?[0-9]*)$/g; - const match = regex.exec(q); - if (match) { - const lat = Number(match[1]); - const lng = Number(match[2]); - if (-90 < lat < 90 && -180 < lng < 180) { - return [ - { - x: lng, - y: lat, - label: q, - bounds: null, - raw: {}, - }, - ]; - } - } - return false; -}