Internal validation logic for Brazilian state registration (IE). Coordinates validation by state using modular validators.
Internal validation logic for Brazilian state registration (IE). Coordinates validation by state using modular validators.
Map of state UF to expected IE length(s). Some states accept multiple lengths (represented as vectors).
Map of state UF to expected IE length(s). Some states accept multiple lengths (represented as vectors).
(valid-ie-length? uf ie-str)Checks if IE has valid length for the given state.
Arguments:
Returns true if length matches expected for the state, false otherwise.
Example: (valid-ie-length? :SP "110042490114") ;; true (12 digits) (valid-ie-length? :RJ "62545372") ;; true (8 digits) (valid-ie-length? :TO "294467696") ;; true (9 digits, TO accepts 9 or 11)
Checks if IE has valid length for the given state. Arguments: - uf: State keyword (e.g., :SP, :RJ) - ie-str: IE string (will be cleaned to only numbers) Returns true if length matches expected for the state, false otherwise. Example: (valid-ie-length? :SP "110042490114") ;; true (12 digits) (valid-ie-length? :RJ "62545372") ;; true (8 digits) (valid-ie-length? :TO "294467696") ;; true (9 digits, TO accepts 9 or 11)
(valid-length? uf ie-str)Checks if IE has valid length for the given state.
Checks if IE has valid length for the given state.
(validate-ie-by-state uf ie-str)Validates IE for a specific state. Returns true if valid, false otherwise.
Validates IE for a specific state. Returns true if valid, false otherwise.
(validate-ie-length uf ie-str)Validates IE length for a state and returns result with error message.
Arguments:
Returns a map with:
Example: (validate-ie-length :SP "110042490114") ;; => {:valid? true}
(validate-ie-length :SP "1234") ;; => {:valid? false, :error "Invalid length: expected 12 digits, got 4"}
Validates IE length for a state and returns result with error message.
Arguments:
- uf: State keyword (e.g., :SP, :RJ)
- ie-str: IE string (will be cleaned to only numbers)
Returns a map with:
- :valid? - boolean indicating if length is valid
- :error - error message string (only present if invalid)
Example:
(validate-ie-length :SP "110042490114")
;; => {:valid? true}
(validate-ie-length :SP "1234")
;; => {:valid? false, :error "Invalid length: expected 12 digits, got 4"}cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |