https://github.com/ahstro/elm-ssn-validation
Validate social security numbers
https://github.com/ahstro/elm-ssn-validation
Last synced: about 1 year ago
JSON representation
Validate social security numbers
- Host: GitHub
- URL: https://github.com/ahstro/elm-ssn-validation
- Owner: ahstro
- License: bsd-3-clause
- Created: 2018-01-03T09:29:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-08T10:55:41.000Z (over 8 years ago)
- Last Synced: 2025-02-05T13:19:59.987Z (over 1 year ago)
- Language: Elm
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-ssn-validation
Validate social security numbers.
If the type of SSN you'd like to validate isn't available, submit an
[issue](https://github.com/ahstro/elm-ssn-validation/issues/new) or,
even better, a [pull request](https://github.com/ahstro/elm-ssn-validation/compare).
## Available SSNs
| Language | Validation | Normalization |
| ------------------------------- | :----------------: | :----------------: |
| :sweden: Swedish (personnummer) | :white_check_mark: | :white_check_mark: |
## Installation
```sh
elm-package install ahstro/elm-ssn-validation
```
## Usage
```elm
import Validation.SSN.Swedish as SSN
case SSN.validate "811218-9876" of
Ok ssn ->
ssn ++ " is valid" -- "811218-9876 is valid"
Err error ->
error
if SSN.isValid "811218-9876" then
"Yay"
else
"Nay"
```
More examples are available in the [/tests](https://github.com/ahstro/elm-ssn-validation/tree/master/tests) folder.