-
<static> get_check_digit(barcode_number) → {number}
-
Calculate and return the check-digit for the specified 11 digit
'barcode_number'. If 'barcode_number' is not numeric and exactly 11 digits
long then null is returned indicating an error.
Parameters:
Name |
Type |
Description |
barcode_number |
string
|
11 digit barcode number |
- Source:
Returns:
calculated check-digit - null if 'barcode_number' invalid
-
Type
-
number
-
<static> valid(barcode_number) → {boolean}
-
Validate that the specified 'barcode_number' is numeric and either 11 or 12
digits long. If 'barcode_number' is 12 digits long then the 12th digit is
verified to be the valid check digit for the first 11 digits.
Parameters:
Name |
Type |
Description |
barcode_number |
string
|
11 or 12 digit barcode number to be validated |
- Source:
Returns:
true if valid - else false
-
Type
-
boolean
-
render()
-
Render this instance's 'barcode_number' as an image into the 'container'
element specified when constructed. Normally this is called internally
when the barcode_number is changed by set_barcode_number() method. But,
it may be useful when a page refresh is needed.
- Source:
-
set_barcode_number(barcode_number)
-
Assign a value to be displayed in this barcode. If provided, the 12th
digit is a check-digit which will be calculated from the 11 digit
'barcode_number'. The barcode image will be updated with this value. If
the barcode has not been added to the DOM yet then it will be added to
'this.container'.
Parameters:
Name |
Type |
Description |
barcode_number |
string
|
11 (or optionally 12) digit barcode |
- Source: