-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathcode128A.ts
34 lines (30 loc) · 891 Bytes
/
code128A.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Code128 } from './code128';
/**
* code128A used to calculate the barcode of type 1228A
*/
export class Code128A extends Code128 {
/**
* Validate the given input.
*
* @returns {string} Validate the given input.
* @param {string} char - provide the input values .
* @private
*/
public validateInput(char: string): string {
if ((new RegExp(`^${'[\x00-\x5F\xC8-\xCF]'}+$`)).test(char)) {
return undefined;
} else {
return 'Supports only ASCII characters 00 to 95 (0–9, A–Z and control codes) and special characters.';
}
}
/**
* Draw the barcode SVG.\
*
* @returns {void} Draw the barcode SVG .
* @param {HTMLElement} canvas - Provide the canvas element .
* @private
*/
public draw(canvas: HTMLElement): void {
this.code128(canvas);
}
}