Metadata-Version: 2.1
Name: luhn-formula
Version: 1.0.3
Summary: Number validator and generator based on luhn's formula
Home-page: https://github.com/code-127/luhn-formula-py.git
Author: code-127
Author-email: 105444219+code-127@users.noreply.github.com
Project-URL: Bug Tracker, https://github.com/code-127/luhn-formula-py/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 5 - Production/Stable
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

# luhn-formula
Another python package of number validator and check digit generator based on Luhn's formula 😉. Luhn's formula was designed to protect against accidental input errors.

[![Python package](https://github.com/code-127/luhn-formula-py/actions/workflows/python-package.yml/badge.svg)](https://github.com/code-127/luhn-formula-py/actions/workflows/python-package.yml)
[![Upload Python Package](https://github.com/code-127/luhn-formula-py/actions/workflows/python-publish.yml/badge.svg)](https://github.com/code-127/luhn-formula-py/actions/workflows/python-publish.yml)

[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/)
[![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)
[![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-390/)
[![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-3100/)
[![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3110/)

## Usage
### install
    pip install luhn-formula
    
or
    
    git clone git@github.com:code-127/luhn-formula-py.git
### Example
    >>> from luhnformula import luhnformula as lf
    >>> lf.getcheckdigit("12345")
    '5'
    >>> lf.addcheckdigit("12345")
    '123455'
    >>> lf.isvalid("123455")
    True
## Function
### checksum(number: str) -> int
    Checksum vith the luhn formula
    Args:
        number : Number to calculate
    return:
        Result of luhn formula
    
### isvalid(number: str) -> bool:
    Validate number with the Luhn formula.
    Args:
        number: Number to validate.
    Returns:
        ``True`` when the: number is valid, otherwise ``False``.
### getcheckdigit(number: str) -> str:
    Generate check digit with the Luhn formula for a number.
    Args:
        number: Number used to generate the check digit.
    Return:
        the check digit for a number.
    Raise error:
        ValueError : Invalid number.
### addcheckdigit(number: str) -> str:
    Generate and add check digit with the luhn formula for a number
    Args:
        number: Number used to generate the check digit.
    Return:
        the number with the check digit.
    Raise error:
        ValueError : Invalid number.
