Liking cljdoc? Tell your friends :D

stdnum.core

Unified validation, parsing, and formatting of standard identifier numbers.

One API over several identifier types - credit cards, IBAN/BIC, ISBN, ISSN, ISIN, US bank routing (ABA), IMEI, and the raw Luhn check - dispatched on a type keyword. Idiomatic Clojure data in and out; an idiomatic facade over the maintained Apache Commons Validator and iban4j engines (it does not reinvent the algorithms).

(valid?  :iban "GB82 WEST 1234 5698 7654 32")  ;=> true
(parse   :credit-card "4111111111111111")      ;=> {:valid? true :network :visa}
(format  :iban "GB82WEST12345698765432")       ;=> "GB82 WEST 1234 5698 7654 32"
(detect  "4111111111111111")                   ;=> [:credit-card :luhn]

valid?/parse/format throw only on an unknown identifier type (a caller bug); bad input data never throws - valid? returns false, parse returns {:valid? false}, format returns nil.

Unified validation, parsing, and formatting of standard identifier numbers.

One API over several identifier types - credit cards, IBAN/BIC, ISBN, ISSN,
ISIN, US bank routing (ABA), IMEI, and the raw Luhn check - dispatched on a
type keyword. Idiomatic Clojure data in and out; an idiomatic facade over the
maintained Apache Commons Validator and iban4j engines (it does not reinvent
the algorithms).

    (valid?  :iban "GB82 WEST 1234 5698 7654 32")  ;=> true
    (parse   :credit-card "4111111111111111")      ;=> {:valid? true :network :visa}
    (format  :iban "GB82WEST12345698765432")       ;=> "GB82 WEST 1234 5698 7654 32"
    (detect  "4111111111111111")                   ;=> [:credit-card :luhn]

`valid?`/`parse`/`format` throw only on an unknown identifier type (a caller
bug); bad input data never throws - `valid?` returns false, `parse` returns
{:valid? false}, `format` returns nil.
raw 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