{"id":26964435,"url":"https://github.com/nicklayb/canada_sin","last_synced_at":"2025-04-03T06:32:21.981Z","repository":{"id":57481984,"uuid":"138048749","full_name":"nicklayb/canada_sin","owner":"nicklayb","description":"Elixir package that validates a Canadian SIN and can get the SIN's province","archived":false,"fork":false,"pushed_at":"2018-06-20T15:17:39.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T05:17:28.530Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicklayb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-20T15:04:15.000Z","updated_at":"2018-06-20T15:17:40.000Z","dependencies_parsed_at":"2022-09-18T19:00:45.592Z","dependency_job_id":null,"html_url":"https://github.com/nicklayb/canada_sin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicklayb%2Fcanada_sin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicklayb%2Fcanada_sin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicklayb%2Fcanada_sin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicklayb%2Fcanada_sin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicklayb","download_url":"https://codeload.github.com/nicklayb/canada_sin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246948013,"owners_count":20859362,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-03T06:31:28.404Z","updated_at":"2025-04-03T06:32:21.974Z","avatar_url":"https://github.com/nicklayb.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CanadaSin\n\n[![Build Status](https://travis-ci.org/nicklayb/canada_sin.svg?branch=master)](https://travis-ci.org/nicklayb/canada_sin) [![Coverage Status](https://coveralls.io/repos/github/nicklayb/canada_sin/badge.svg?branch=master)](https://coveralls.io/github/nicklayb/canada_sin?branch=master)\n\n\nElixir package that validates a Canadian SIN and can get the SIN's province\n\n## Installation\n\nThe package can be installed by adding `canada_sin` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:canada_sin, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) and published on [HexDocs](https://hexdocs.pm). Once published, the docs can be found at [https://hexdocs.pm/canada_sin](https://hexdocs.pm/canada_sin).\n\n## Usage\n**Note**: The SIN used in example is a fake SIN. It does not belongs to anyone\n\n### Validate\n\nYou can use the `CanadaSin.valid?/1` function to validate if the sin matches Canadian rules. You can pass in a string or a number, since first char `0` is not used in Canada.\n\n```elixir\nCanadaSin.valid? \"130 692 544\"\n```\n\nYou can also pass in an integer directly\n\n```elixir\nCanadaSin.valid? 130692544\n```\n\n### Get provinces\n\nYou can also get valid provinces. Using the `CanadaSin.province/1` will return a list of atom of province codes\n\n**Note**: It does not validate the SIN, it only gives the province matching the first digit. It would return `[]` for an invalid province code.\n\n```elixir\nCanadaSin.province (\"211 111 111\")\n[:QC]\n```\n\n## References\n\nFor references on how the SIN is calculated, you can refer here [http://www.straightlineinternational.com/docs/vaildating_canadian_sin.pdf](http://www.straightlineinternational.com/docs/vaildating_canadian_sin.pdf).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicklayb%2Fcanada_sin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicklayb%2Fcanada_sin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicklayb%2Fcanada_sin/lists"}