package luna
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=f568b6c171310ae9ef565853a69049f4
sha512=a11847d2bcb0929540f022f9f95aa40cb266c1c911ab220837e4066c31dc3bb82aa10a10c07766abfb6e1f8e4f6e5cf40738d5cb7c0cbfac012a4b2b3a694c34
Description
A library to validate numbers using the Luhn algorithm
README
Luna
Luna is a validation library implementing the Luhn algorithm for OCaml.
Installation
To start using the library, you can install it via opam
opam pin add -y git+https://github.com/crowlabs-hq/luna.gitUsage
Luna can be used as follows:
Validating a number
let is_valid nb =
if Luna.validate nb then
Printf.printf "%s: Valid number !\n" nb
else Printf.printf "%s: Invalid number !\n" nb
let () =
is_valid "17893729974";
is_valid "28924292203"
(*
17893729974: Valid number !
28924292203: Invalid number !
*)Calculating the check digit
let get_digit nb =
let result = Luna.checksum_digit nb in
Printf.printf "The check digit for number %s is %d\n" nb result
let () =
get_digit "1789372997";
get_digit "28924292203"
(*
The check digit for number 1789372997 is 4
The check digit for number 28924292203 is 6
*)License
This project is licensed under the MIT License - see the LICENSE file for details.
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building luna with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.1.0 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure