Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UPC A and E support #25

Merged
merged 2 commits into from
May 28, 2021
Merged

Add UPC A and E support #25

merged 2 commits into from
May 28, 2021

Conversation

h3x4d3c1m4l
Copy link
Contributor

@h3x4d3c1m4l h3x4d3c1m4l commented Jan 19, 2021

This PR adds support for the two most commonly used UPC barcodes. As UPC A is very similar to EAN 13, it's code could make use of the existing EAN 13 support ("Don't Repeat Yourself") but I decided to implement it as a separate symbology for the following reasons:

  • Using the existing EAN 13 code could make the UPC A encoder throw exceptions which are specific to EAN 13 (this could confuse both developers and end users)
  • The UPC A encoding scheme is a lot simpler than the EAN 13 encoding scheme, any bugs in the EAN 13 implementation are ruled out this way and I think the code is more clear this way (less cyclomatic complexity, UpcAEncoder code easy to follow)

Let me know your thoughts on this, I can of course adapt the code to use the existing EAN 13 implementation :)

@huysentruitw huysentruitw merged commit c0cb23d into huysentruitw:develop May 28, 2021
@huysentruitw
Copy link
Owner

Thank you for this PR, I totally forgot about it 😳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants