ex_gtin v0.1.0 ExGtin View Source

Documentation for ExGtin. This library provides functionality for validating GTIN compliant codes.

Link to this section Summary

Functions

Check for valid GTIN-8, GTIN-12, GTIN-13, GTIN-14, GSIN, SSCC codes

Calculates the sum of the digits in a string and multiplied value based on index order

Calculates the difference of the highest rounded multiple of 10

Link to this section Functions

Link to this function gtin_check_digit(number) View Source
gtin_check_digit(string) :: {atom}
gtin_check_digit(number) :: {atom}
gtin_check_digit([number]) :: {atom}

Check for valid GTIN-8, GTIN-12, GTIN-13, GTIN-14, GSIN, SSCC codes

Returns {:ok} or {:error}

Examples

iex> ExGtin.gtin_check_digit("6291041500213")
{:ok}

iex> ExGtin.gtin_check_digit("6291041500214")
{:error}
Link to this function mult_by_index_code(index) View Source
Link to this function multiply_and_sum_array(numbers) View Source
multiply_and_sum_array([number]) :: number

Calculates the sum of the digits in a string and multiplied value based on index order

Returns sum of values

Examples

iex> ExGtin.multiply_and_sum_array([6,2,9,1,0,4,1,5,0,0,2,1])
57
Link to this function subtract_from_nearest_multiple_of_ten(number) View Source
subtract_from_nearest_multiple_of_ten(number) :: number

Calculates the difference of the highest rounded multiple of 10

Returns the difference of the highest rounded multiple of 10

Examples

iex> ExGtin.subtract_from_nearest_multiple_of_ten(57)
3