Liking cljdoc? Tell your friends :D

brazilian-utils.inscricao-estadual.internal

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.
raw docstring

ie-length-by-stateclj/s

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).
sourceraw docstring

valid-ie-length?clj/s

(valid-ie-length? uf ie-str)

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)

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)
sourceraw docstring

valid-length?clj/s

(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.
sourceraw docstring

validate-ie-by-stateclj/s

(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.
sourceraw docstring

validate-ie-lengthclj/s

(validate-ie-length uf ie-str)

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"}

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"}
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close