1.0.2 • Published 22h ago
gs1-datamatrix-decoder
Licence
MIT
Version
1.0.2
Deps
0
Size
41 kB
Vulns
0
Weekly
0
gs1-datamatrix-decoder
A lightweight GS1 Data Matrix parser focused on common pharmaceutical and inventory workflows.
Install
npm install gs1-datamatrix-decoder
Usage
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