Skip to content

Commit

Permalink
fix: don't invoke trim when query is undefined (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjvoosten authored and smeijer committed Oct 17, 2023
1 parent 1f19d1a commit 036eb33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/coords.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-nocheck

export function validateCoords(query) {
const q = query.trim();
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) {
Expand Down

0 comments on commit 036eb33

Please sign in to comment.