@stacksjs/qrx
Version:
QR & Bar Code generating & reading. Lightweight & powerful.
20 lines (17 loc) • 439 B
TypeScript
declare function checksum(data: string): void;
export declare class EAN5 extends Barcode {
constructor(data: string, options: any) {
super(data, options)
}
valid(): boolean {
return this.data.search(/^\d{5}$/) !== -1
}
encode(): any {
const structure = EAN5_STRUCTURE[checksum(this.data)]
return {
data: `1011${encode(this.data, structure, '01')}`,
text: this.text,
}
}
}
export default EAN5;