Liking cljdoc? Tell your friends :D

brazilian-utils.states.validation

Validation schemas for Brazilian states (UF).

Uses malli to define and validate state-related data structures.

Validation schemas for Brazilian states (UF).

Uses malli to define and validate state-related data structures.
raw docstring

Stateclj/s

Schema for Brazilian state code (UF).

Accepts any of the 27 Brazilian state codes.

Example: (m/validate State :SP) ;; true (m/validate State :MG) ;; true (m/validate State :XX) ;; false

Schema for Brazilian state code (UF).

Accepts any of the 27 Brazilian state codes.

Example:
(m/validate State :SP) ;; true
(m/validate State :MG) ;; true
(m/validate State :XX) ;; false
sourceraw docstring

StateDataclj/s

Schema for a state's structured data.

Contains the following fields:

  • code: Unique numeric code for the state
  • name: Full state name
  • area-codes: Vector of telephone area codes (DDDs)
  • ie-length: Length of the State Registration (IE) in digits

Example: {:code "8" :name "São Paulo" :area-codes [11 12 13 14 15 16 17 18 19] :ie-length 12}

Schema for a state's structured data.

Contains the following fields:
- code: Unique numeric code for the state
- name: Full state name
- area-codes: Vector of telephone area codes (DDDs)
- ie-length: Length of the State Registration (IE) in digits

Example:
{:code "8" 
 :name "São Paulo" 
 :area-codes [11 12 13 14 15 16 17 18 19] 
 :ie-length 12}
sourceraw docstring

StatesDataByUfclj/s

Schema for the state data map (as in resources/states.edn).

Maps each UF to its structured state data.

Example: {:SP {:code "8" :name "São Paulo" :area-codes [...] :ie-length 12} :RJ {:code "7" :name "Rio de Janeiro" :area-codes [...] :ie-length 8}}

Schema for the state data map (as in resources/states.edn).

Maps each UF to its structured state data.

Example:
{:SP {:code "8" :name "São Paulo" :area-codes [...] :ie-length 12}
 :RJ {:code "7" :name "Rio de Janeiro" :area-codes [...] :ie-length 8}}
sourceraw docstring

valid-uf?clj/s

(valid-uf? uf)

Returns true if uf is a valid Brazilian state keyword.

Arguments:

  • uf: Keyword representing the state abbreviation

Returns true if valid, false otherwise.

Example: (valid-uf? :SP) ;; true (valid-uf? :XX) ;; false

Returns true if uf is a valid Brazilian state keyword.

Arguments:
- uf: Keyword representing the state abbreviation

Returns true if valid, false otherwise.

Example:
(valid-uf? :SP) ;; true
(valid-uf? :XX) ;; false
sourceraw docstring

validate-states-mapclj/s

(validate-states-map value)

Validates that a map conforms to the full states data structure.

Returns true if valid, false otherwise.

Example: (validate-states-map {:SP {:code "8" :name "São Paulo" ...} :RJ {:code "7" :name "Rio de Janeiro" ...}}) ;; true

Validates that a map conforms to the full states data structure.

Returns true if valid, false otherwise.

Example:
(validate-states-map {:SP {:code "8" :name "São Paulo" ...}
                      :RJ {:code "7" :name "Rio de Janeiro" ...}})
;; true
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