diff --git a/.gitignore b/.gitignore index 820e90a1323182bf8defda28a9f52f4da097c69d..0a131f7e680012e69cdffe15394c960f6aecd5bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ *~ \#* .#* -.elc +*.elc diff --git a/README.md b/README.md index d51b5bf6b3fc3fa78552773a0e3add0323b44237..13316d5cf1a18010c757c5dd263c0ef0a2571389 100644 --- a/README.md +++ b/README.md @@ -104,3 +104,14 @@ The OLC parse is a structure mainly used internally. Unless you call geographical reference to coordinates. Please make sure you follow the acceptable use policy for the API (e.g., one request per second, tops, allowed). + +`(olc-is-valid CODE)` +: Returns non-nil if `CODE` is a valid open location code. + +`(olc-is-short CODE)` +: Returns non-nil if `CODE` is a valid short location code. Returns + nil for valid short and for invalid codes. + +`(olc-is-full CODE)` +: Returns non-nil if `CODE` is a valid full open location code. + Returns nil for valid long and for invalid codes. diff --git a/olc.el b/olc.el index a431ecb89f52f3ce77ad4626afbea42484341886..be38e8ebd7cdd7dbe99f3065060e3a31f7c2923d 100644 --- a/olc.el +++ b/olc.el @@ -91,8 +91,7 @@ (pairs nil :read-only t) (grid nil :read-only t) (short nil :read-only t) - (precision nil :read-only t) - (code nil :read-only t)) + (precision nil :read-only t)) (defsubst olc-parse-length (parse) "Get length from a parsed open location code PARSE." @@ -224,24 +223,13 @@ (olc-parse-create :pairs (nreverse pairs) :grid (nreverse grid) :short short - :precision precision - :code code)))) + :precision precision)))) ;;; ======================================================================== ;;; Public functions ;;; ======================================================================== -(defsubst olc-valid-digits (value) - "Return non-nil if VALUE consists of valid digits. - -VALUE can be a character or sequence of characters." - (condition-case nil - (if (characterp value) - (olc-digit-value char) - (mapc 'olc-digit-value char)) - (error nil))) - (defun olc-is-valid (code) "Return non-nil if CODE is a valid open location code." (condition-case nil