gs1-datamatrix-decoder
v1.0.0
Published
GS1 Data Matrix decoder for barcode scanner payloads
Downloads
115
Readme
gs1-datamatrix-decoder
A lightweight GS1 Data Matrix parser focused on common pharmaceutical and inventory workflows.
Install
npm install gs1-datamatrix-decoderUsage
import { decodeGS1DataMatrix } from 'gs1-datamatrix-decoder';
const data = decodeGS1DataMatrix(']d20106285101000737172611141069122110004901362134');
console.log(data.gtin);
console.log(data.expiryDate);
console.log(data.batchNumber);
console.log(data.serialNumber);Output shape
export interface GS1Data {
gtin?: string;
serialNumber?: string;
batchNumber?: string;
expiryDate?: string;
productionDate?: string;
quantity?: string;
netWeight?: string;
count?: string;
[key: string]: string | undefined;
}Supported application identifiers
- 01 GTIN
- 10 Batch or lot
- 11 Production date
- 17 Expiry date
- 21 Serial
- 30 Quantity
- 37 Count
- 310x Net weight
Notes
- Symbology prefixes such as ]d2, ]C1, ]e0 are automatically removed.
- Dates are returned as YYYY-MM-DD.
- GS1 day 00 for date fields is interpreted as the last day of the month.
- Invalid or non-decodable input returns an empty object.
Development
npm run build
npm run test