{"id":13509721,"url":"https://github.com/kickinespresso/ex_gtin","last_synced_at":"2025-06-24T08:39:31.195Z","repository":{"id":62429122,"uuid":"96144891","full_name":"kickinespresso/ex_gtin","owner":"kickinespresso","description":"Elixir GTIN \u0026 UPC Generation and Validation Library","archived":false,"fork":false,"pushed_at":"2022-11-16T15:37:35.000Z","size":99,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T00:52:06.274Z","etag":null,"topics":["elixir","gln","gs1","gsin","gtin","gtin-codes","sscc","upc"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kickinespresso.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2017-07-03T19:40:32.000Z","updated_at":"2022-11-23T23:55:26.000Z","dependencies_parsed_at":"2023-01-23T11:00:45.255Z","dependency_job_id":null,"html_url":"https://github.com/kickinespresso/ex_gtin","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kickinespresso%2Fex_gtin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kickinespresso%2Fex_gtin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kickinespresso%2Fex_gtin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kickinespresso%2Fex_gtin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kickinespresso","download_url":"https://codeload.github.com/kickinespresso/ex_gtin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243865663,"owners_count":20360480,"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":["elixir","gln","gs1","gsin","gtin","gtin-codes","sscc","upc"],"created_at":"2024-08-01T02:01:11.991Z","updated_at":"2025-06-24T08:39:31.187Z","avatar_url":"https://github.com/kickinespresso.png","language":"Elixir","funding_links":[],"categories":["Validations"],"sub_categories":[],"readme":"# ExGtin\n\n![CI Status](https://github.com/kickinespresso/ex_gtin/actions/workflows/elixir.yml/badge.svg)\n[![Static Badge](https://img.shields.io/badge/HexDocs-ex_gtin-blue)](https://hexdocs.pm/ex_gtin/ExGtin.html)\n[![Hex.pm Version](https://img.shields.io/hexpm/v/ex_gtin)](https://hex.pm/packages/ex_gtin)\n[![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg)](LICENSE.md)\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/kickinespresso/ex_gtin/issues)\n\nA [GTIN](https://www.gtin.info/) (Global Trade Item Number) \u0026 UPC (Universal Price Code) Generation and Validation Library in Elixir under the GS1 specification.\n\n- GTIN-8 (EAN/UCC-8): this is an 8-digit number used predominately outside of North America\n- GTIN-12 (UPC-A): this is a 12-digit number used primarily in North America\n- GTIN-13 (EAN/UCC-13): this is a 13-digit number used predominately outside of North America - Global Location Number (GLN)\n- GTIN-14 (EAN/UCC-14 or ITF-14): this is a 14-digit number used to identify trade items at various packaging levels\n\n## Features\n\n- Supports GTIN-8, GTIN-12 (UPC-12), GTIN-13 (GLN), GTIN-14\n- Generate GTIN\n- Check GTIN validity\n- Lookup GS1 country prefix\n- Convert (normalize) GTIN-13 to GTIN-14\n\nFeatures to Come:\n\n- Global Shipment Identification Number (GSIN)\n- Serial Shipping Container Code (SSCC)\n\n## Installation\n\n_WARNING `1.0.1` contains breaking changes from `1.0.0`_ (I know this is a patch release but the breaking changes related to the deprecation of `check_gtin` and `generate_gtin` were noted in the changelog and docs over a year ago)\n_WARNING `1.0.0` contains breaking changes from `0.4.0`_\n\nAdd `:ex_gtin` as a dependency to your project's `mix.exs`:\n\n```elixir\ndef deps do\n  [{:ex_gtin, \"~\u003e 1.2.0\"}]\nend\n```\n\nand run `mix deps.get` to install the `:ex_gtin` dependency\n\n```shell\nmix deps.get\n```\n\n## Usage\n\n- Check GTIN codes\n\n```elixir\niex\u003e ExGtin.validate(\"6291041500213\")\n{:ok, \"GTIN-13\"}\n\niex\u003e ExGtin.validate(\"6291041500214\")\n{:error, \"Invalid Code\"}\n\niex\u003e ExGtin.validate!(\"6291041500213\")\n\"GTIN-13\"\n```\n\nPass GTIN numbers in as a String, Number or an Array\n\n```elixir\niex\u003e number = [6, 2, 9, 1, 0, 4, 1, 5, 0, 0, 2, 1, 3]\niex\u003e ExGtin.validate(number)\n{:ok, \"GTIN-13\"}\n\niex\u003e number = 6_291_041_500_213\niex\u003e ExGtin.validate(number)\n{:ok, \"GTIN-13\"}\n```\n\n- Generate GTIN codes\n\n```elixir\niex\u003e ExGtin.generate(\"629104150021\")\n{:ok, \"6291041500213\"}\n\niex\u003e ExGtin.generate!(\"629104150021\")\n\"6291041500213\"\n```\n\n- Lookup GS1 Prefix\n\n```elixir\niex\u003e ExGtin.Validation.find_gs1_prefix_country(\"53523235\")\n{:ok, \"GS1 Malta\"}\n```\n\n- Convert GTIN-13 to GTIN 14\n\n```elixir\niex\u003e ExGtin.normalize(\"6291041500213\")\n{:ok, \"16291041500210\"}\n```\n\n### Using Strings, Arrays or Numbers\n\n- String\n\n```elixir\niex\u003e ExGtin.validate(\"6291041500213\")\n{:ok, \"GTIN-13\"}\n```\n\n- Array of Integers\n\n```elixir\niex\u003e ExGtin.validate([6, 2, 9, 1, 0, 4, 1, 5, 0, 0, 2, 1, 3])\n{:ok, \"GTIN-13\"}\n```\n\n- Integer\n\n```elixir\niex\u003e ExGtin.validate(6291041500213)\n{:ok, \"GTIN-13\"}\n```\n\nIntegers with leading zeros may not process properly\n\n## Reference\n\n- [GTIN](https://www.gs1.org)\n- [How to calculate GTIN](https://www.gs1.org/how-calculate-check-digit-manually)\n\nDocumentation can be found at [https://hexdocs.pm/ex_gtin](https://hexdocs.pm/ex_gtin) on [HexDocs](https://hexdocs.pm).\n\n## Tests\n\nRun tests with\n\n```shell\nmix test\n```\n\nRun test coverage\n\n```shell\nMIX_ENV=test mix coveralls\n```\n\nProduce Coverage report in HTML to `cover/excoveralls.html`\n\n```shell\nMIX_ENV=test mix coveralls.html\n```\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\nWhen making pull requests, please be sure to update the [CHANGELOG.md](CHANGELOG.md) with the corresponding changes. Please make sure that all tests pass, add tests for new functionality and that the static analysis checker `credo` is run. Use `mix pull_request_checkout.task` to ensure that everything checks out.\n\nRun static code analysis\n\n```shell\nmix credo\n```\n\nGenerate Documentation\n\n```shell\nmix docs\n```\n\nRun the gambit of tests, static analysis and coverage\n\n```shell\nmix pull_request_checkout.task\n```\n\n## Sponsors\n\nThis project is sponsored by [KickinEspresso](https://kickinespresso.com/?utm_source=github\u0026utm_medium=sponsor\u0026utm_campaign=opensource)\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/kickinespresso/ex_gtin/tags).\n\n## Code of Conduct\n\nPlease refer to the [Code of Conduct](CODE_OF_CONDUCT.md) for details\n\n## Security\n\nPlease refer to the [Security](SECURITY.md) for details\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\n## Publish \u0026 Releasing\n\n```shell\nmix hex.publish\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkickinespresso%2Fex_gtin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkickinespresso%2Fex_gtin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkickinespresso%2Fex_gtin/lists"}