Socket
Socket
Sign inDemoInstall

barcode-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 2.1.0

lib/enums/ai-code.d.ts

8

lib/__tests__/barcode-parser.spec.js

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -18,3 +18,3 @@ };

var barcode_parser_1 = require("../barcode-parser");
var config_1 = require("../config");
var enums_1 = require("../enums");
var TestClass = /** @class */ (function (_super) {

@@ -39,8 +39,8 @@ __extends(TestClass, _super);

config = {
readers: config_1.Symbologies.All,
readerConfigurations: [],
readers: enums_1.Symbologies.All,
};
classUnderTest = new TestClass(config);
});
it("should return IBarcodeValue with errorMessage as 'No Reader Found'", function () {
it('should return IBarcodeValue with errorMessage as \'No Reader Found\'', function () {
var result = classUnderTest.parse('invalid');

@@ -47,0 +47,0 @@ expect(result.errorMessage).toBe('No Reader Found');

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var config_1 = require("../../config");
var enums_1 = require("../../enums");
describe('AimCodes', function () {
describe('GS1', function () {
it('should return GS1 code', function () {
expect(config_1.AimCodes.GS1).toBe(']C1');
expect(enums_1.AimCodes.GS1).toBe(']C1');
});

@@ -12,3 +12,3 @@ });

it('should return GTIN code', function () {
expect(config_1.AimCodes.GTIN).toBe(']E0');
expect(enums_1.AimCodes.GTIN).toBe(']E0');
});

@@ -18,3 +18,3 @@ });

it('should return ITF code', function () {
expect(config_1.AimCodes.ITF).toBe(']I0');
expect(enums_1.AimCodes.ITF).toBe(']I0');
});

@@ -24,3 +24,3 @@ });

it('should return CODE39 code', function () {
expect(config_1.AimCodes.CODE39).toBe(']A0');
expect(enums_1.AimCodes.CODE39).toBe(']A0');
});

@@ -30,3 +30,3 @@ });

it('should return CODE128 code', function () {
expect(config_1.AimCodes.CODE128).toBe(']C0');
expect(enums_1.AimCodes.CODE128).toBe(']C0');
});

@@ -36,3 +36,3 @@ });

it('should return EAN code', function () {
expect(config_1.AimCodes.EAN13).toBe(']E3');
expect(enums_1.AimCodes.EAN13).toBe(']E3');
});

@@ -39,0 +39,0 @@ });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var models_1 = require("../../models");
var symbologies_1 = require("../../config/symbologies");
describe('BarcodeValue', function () {

@@ -18,22 +17,2 @@ var classUnderTest;

});
test('isWeightBased should be true for GTIN13', function () {
classUnderTest = new models_1.BarcodeValue(symbologies_1.Symbologies.GTIN13, '');
classUnderTest.values = '2843970021365';
expect(classUnderTest.isWeightBased).toBeTruthy();
});
test('isWeightBased should be false for other Systems', function () {
classUnderTest = new models_1.BarcodeValue(symbologies_1.Symbologies.GTIN13, '');
classUnderTest.values = '3843970021365';
expect(classUnderTest.isWeightBased).toBeFalsy();
});
test('systemId should return first half value', function () {
classUnderTest = new models_1.BarcodeValue(symbologies_1.Symbologies.GTIN13, '');
classUnderTest.values = '2843970021365';
expect(classUnderTest.systemId).toEqual('84397');
});
test('systemValue should return second half value', function () {
classUnderTest = new models_1.BarcodeValue(symbologies_1.Symbologies.GTIN13, '');
classUnderTest.values = '2843970021365';
expect(classUnderTest.systemMeasure).toEqual(21.36);
});
describe('pluck', function () {

@@ -40,0 +19,0 @@ test('return values of existing keys', function () {

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,2 +17,3 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.TestReader = void 0;
var base_gtin_reader_1 = require("../../readers/base-gtin.reader");

@@ -19,0 +20,0 @@ var REG = /[0-9]/;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -29,3 +29,3 @@ };

},
enumerable: true,
enumerable: false,
configurable: true

@@ -32,0 +32,0 @@ });

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,2 +17,3 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Tester = void 0;
var code_128_reader_1 = require("../../readers/code-128.reader");

@@ -19,0 +20,0 @@ var Tester = /** @class */ (function (_super) {

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.TestClass = void 0;
var code_39_reader_1 = require("../../readers/code-39.reader");
var aim_codes_1 = require("../../config/aim-codes");
var enums_1 = require("../../enums");
var TestClass = /** @class */ (function (_super) {

@@ -38,7 +39,8 @@ __extends(TestClass, _super);

var decodeValues = [
aim_codes_1.AimCodes.CODE39 + 'P0010065330101',
aim_codes_1.AimCodes.CODE39 + 'I0010065330101',
aim_codes_1.AimCodes.CODE39 + 'M0010065330101',
aim_codes_1.AimCodes.CODE39 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-$%.+/',
aim_codes_1.AimCodes.CODE39 + 'A',
enums_1.AimCodes.CODE39 + 'P0010065330101',
enums_1.AimCodes.CODE39 + 'I0010065330101',
enums_1.AimCodes.CODE39 + 'M0010065330101',
enums_1.AimCodes.CODE39 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-$%.+/',
enums_1.AimCodes.CODE39 + 'A',
enums_1.AimCodes.CODE39 + '1234567777777',
];

@@ -65,2 +67,39 @@ var invalidValues = [

});
it('should return entire value if no embedded data', function () {
var configWithNoValues = {
symbology: enums_1.Symbologies.Code39,
values: [],
};
classUnderTest = new code_39_reader_1.Code39Reader(configWithNoValues);
var result = classUnderTest.decode(decodeValues[5]);
expect(result.values).toEqual('1234567777777');
});
it('should return entire value if no config', function () {
classUnderTest = new code_39_reader_1.Code39Reader();
var result = classUnderTest.decode(decodeValues[5]);
expect(result.values).toEqual('1234567777777');
});
it('should parse embedded data indexes from config', function () {
var configWithEmbeddedData = {
symbology: enums_1.Symbologies.Code39,
values: [
{
length: 2,
start: 0,
valueType: 'foo',
},
{
length: 3,
start: 2,
valueType: 'bar',
},
],
};
classUnderTest = new code_39_reader_1.Code39Reader(configWithEmbeddedData);
var result = classUnderTest.decode(decodeValues[5]);
expect(result.values).toEqual(expect.arrayContaining([
{ code: 'foo', value: '12' },
{ code: 'bar', value: '345' },
]));
});
});

@@ -67,0 +106,0 @@ describe('validate', function () {

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,2 +17,3 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Tester = void 0;
var gs_1_reader_1 = require("../../readers/gs-1.reader");

@@ -206,2 +207,3 @@ var Tester = /** @class */ (function (_super) {

var actual3 = classUnderTest.decode(']C102084135560009503703 10ES003472002'.replace(' ', String.fromCharCode(29)));
var actual4 = classUnderTest.decode(']C102084135560009503703 700720211024'.replace(' ', String.fromCharCode(29)));
expect(actual.values).toContainEqual({

@@ -245,4 +247,13 @@ code: '21',

});
expect(actual4.values).toContainEqual({
code: '02',
value: '08413556000950',
});
expect(actual4.values).toContainEqual({ code: '37', value: '03' });
expect(actual4.values).toContainEqual({
code: '7007',
value: '20211024',
});
});
});
//# sourceMappingURL=gs-1.reader.spec.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var config_1 = require("./../../config");
var enums_1 = require("../../enums");
var utils_1 = require("../../utils");

@@ -9,33 +9,33 @@ describe('AimParser', function () {

test('should strip AIM Code from gtin_8', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.GTIN8, config_1.AimCodes.GTIN + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.GTIN8, enums_1.AimCodes.GTIN + value)).toBe(value);
});
test('should strip AIM Code from gtin_12', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.GTIN12, config_1.AimCodes.GTIN + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.GTIN12, enums_1.AimCodes.GTIN + value)).toBe(value);
});
test('should strip AIM Code from gtin_13', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.GTIN13, config_1.AimCodes.GTIN + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.GTIN13, enums_1.AimCodes.GTIN + value)).toBe(value);
});
test('should strip AIM Code from gtin_14', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.GTIN14, config_1.AimCodes.GTIN + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.GTIN14, enums_1.AimCodes.GTIN + value)).toBe(value);
});
test('should strip AIM Code from itf_8', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.ITF8, config_1.AimCodes.ITF + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.ITF8, enums_1.AimCodes.ITF + value)).toBe(value);
});
test('should strip AIM Code from itf_12', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.ITF12, config_1.AimCodes.ITF + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.ITF12, enums_1.AimCodes.ITF + value)).toBe(value);
});
test('should strip AIM Code from itf_13', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.ITF13, config_1.AimCodes.ITF + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.ITF13, enums_1.AimCodes.ITF + value)).toBe(value);
});
test('should strip AIM Code from itf_14', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.ITF14, config_1.AimCodes.ITF + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.ITF14, enums_1.AimCodes.ITF + value)).toBe(value);
});
test('should strip AIM Code from GS1', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.GS1128, config_1.AimCodes.GS1 + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.GS1128, enums_1.AimCodes.GS1 + value)).toBe(value);
});
test('should strip AIM Code from CODE_39', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.Code39, config_1.AimCodes.CODE39 + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.Code39, enums_1.AimCodes.CODE39 + value)).toBe(value);
});
test('should strip AIM Code from CODE_128', function () {
expect(utils_1.AimParser.parseAimCode(config_1.Symbologies.Code128, config_1.AimCodes.CODE128 + value)).toBe(value);
expect(utils_1.AimParser.parseAimCode(enums_1.Symbologies.Code128, enums_1.AimCodes.CODE128 + value)).toBe(value);
});

@@ -42,0 +42,0 @@ });

import { IBarcodeValue, IParserConfiguration, IReaderConfiguration } from './models';
export declare class BarcodeParser {
private _readers;
readers: any;
get readers(): any;
set readers(value: any);
constructor(config: IParserConfiguration);
parse(barcodeVal: any): IBarcodeValue;
protected initReaders(readerTypes: string[], configurations: IReaderConfiguration[]): void;
protected initReaders(readerTypes: string[], configurations: IReaderConfiguration[], verbose?: boolean): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BarcodeParser = void 0;
var readers_1 = require("./readers");

@@ -7,3 +8,3 @@ var models_1 = require("./models");

function BarcodeParser(config) {
this.initReaders(config.readers, config.readerConfigurations);
this.initReaders(config.readers, config.readerConfigurations, config.verbose);
}

@@ -17,3 +18,3 @@ Object.defineProperty(BarcodeParser.prototype, "readers", {

},
enumerable: true,
enumerable: false,
configurable: true

@@ -35,3 +36,4 @@ });

};
BarcodeParser.prototype.initReaders = function (readerTypes, configurations) {
BarcodeParser.prototype.initReaders = function (readerTypes, configurations, verbose) {
if (verbose === void 0) { verbose = false; }
this.readers = readerTypes.map(function (r) {

@@ -47,7 +49,9 @@ var readerConfig;

});
/* tslint:disable */
this._readers.forEach(function (reader) {
return console.log('Reader Initialized: ', reader);
});
/* tslint:enable */
if (verbose) {
/* tslint:disable */
this._readers.forEach(function (reader) {
return console.log('Reader Initialized: ', reader);
});
/* tslint:enable */
}
};

@@ -54,0 +58,0 @@ return BarcodeParser;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CONTROLCHARS = void 0;
exports.CONTROLCHARS = [29];
//# sourceMappingURL=control-characters.js.map

@@ -1,3 +0,1 @@

export * from './aim-codes';
export * from './symbologies';
export * from './control-characters';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./aim-codes"));
__export(require("./symbologies"));
__export(require("./control-characters"));
__exportStar(require("./control-characters"), exports);
//# sourceMappingURL=index.js.map
import { BarcodeParser } from './barcode-parser';
import { IBarcodeValue, IParserConfiguration } from './models/';
import { Symbologies } from './config/symbologies';
export { BarcodeParser, IBarcodeValue, IParserConfiguration, Symbologies };
import { AICode, Symbologies } from './enums';
export { AICode, BarcodeParser, IBarcodeValue, IParserConfiguration, Symbologies };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Symbologies = exports.BarcodeParser = exports.AICode = void 0;
var barcode_parser_1 = require("./barcode-parser");
exports.BarcodeParser = barcode_parser_1.BarcodeParser;
var symbologies_1 = require("./config/symbologies");
exports.Symbologies = symbologies_1.Symbologies;
Object.defineProperty(exports, "BarcodeParser", { enumerable: true, get: function () { return barcode_parser_1.BarcodeParser; } });
var enums_1 = require("./enums");
Object.defineProperty(exports, "AICode", { enumerable: true, get: function () { return enums_1.AICode; } });
Object.defineProperty(exports, "Symbologies", { enumerable: true, get: function () { return enums_1.Symbologies; } });
//# sourceMappingURL=index.js.map

@@ -7,9 +7,9 @@ export declare class ApplicationIdentifier {

private frac;
readonly code: string;
readonly length: number;
readonly variableLength: boolean;
readonly description: string;
readonly totalLength: number;
readonly fractional: boolean;
get code(): string;
get length(): number;
get variableLength(): boolean;
get description(): string;
get totalLength(): number;
get fractional(): boolean;
constructor(_code: string, _description: string, _length: number, _variableLength: boolean, frac?: boolean);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApplicationIdentifier = void 0;
var ApplicationIdentifier = /** @class */ (function () {

@@ -16,3 +17,3 @@ function ApplicationIdentifier(_code, _description, _length, _variableLength, frac) {

},
enumerable: true,
enumerable: false,
configurable: true

@@ -24,3 +25,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -32,3 +33,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -40,3 +41,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -50,3 +51,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -58,3 +59,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -61,0 +62,0 @@ });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.APPLICATION_IDENTIFIERS = void 0;
var application_identifier_1 = require("./application-identifier");
exports.APPLICATION_IDENTIFIERS = [
new application_identifier_1.ApplicationIdentifier('00', 'Serial Shipping Container Code', 18, false),
new application_identifier_1.ApplicationIdentifier('01', 'Global Trade Item Number', 14, false),
new application_identifier_1.ApplicationIdentifier('02', 'GTIN of Contained Trade Items', 14, false),
new application_identifier_1.ApplicationIdentifier('10', 'Batch/Lot Number', 20, true),
new application_identifier_1.ApplicationIdentifier('11', 'Production Date', 6, false),
new application_identifier_1.ApplicationIdentifier('12', 'DueDate', 6, false),
new application_identifier_1.ApplicationIdentifier('13', 'Packaging Date', 6, false),
new application_identifier_1.ApplicationIdentifier('15', 'Best Befor eDate YYMMDD', 6, false),
new application_identifier_1.ApplicationIdentifier('17', 'Expiration Date', 6, false),
new application_identifier_1.ApplicationIdentifier('20', 'Product Variant', 2, false),
new application_identifier_1.ApplicationIdentifier('21', 'Serial Number', 20, true),
new application_identifier_1.ApplicationIdentifier('22', 'Secondary Data Fields', 29, true),
new application_identifier_1.ApplicationIdentifier('23n', 'Lot number[n]', 19, true),
new application_identifier_1.ApplicationIdentifier('240', 'Additional Product Identification', 30, true),
new application_identifier_1.ApplicationIdentifier('241', 'Customer Part Number', 30, true),
new application_identifier_1.ApplicationIdentifier('242', 'Made-to-Order Variation Number', 6, true),
new application_identifier_1.ApplicationIdentifier('250', 'Secondary Serial Number', 30, true),
new application_identifier_1.ApplicationIdentifier('251', 'Reference to SourceEntity', 30, true),
new application_identifier_1.ApplicationIdentifier('253', 'Global Document Type Identifier', 17, true),
new application_identifier_1.ApplicationIdentifier('254', 'GLN Extension Component', 20, true),
new application_identifier_1.ApplicationIdentifier('255', 'Global Coupon Number GCN', 25, true),
new application_identifier_1.ApplicationIdentifier('30', 'Count of items', 8, true),
new application_identifier_1.ApplicationIdentifier('310', 'Product Net Weight in kg', 6, false, true),
new application_identifier_1.ApplicationIdentifier('311', 'Product Length/1st Dimension,in meters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('312', 'Product Width/Diameter/2nd Dimension,in meters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('313', 'Product Depth/Thickness/Height/3rd Dimension,in meters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('314', 'Product Area,in square meters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('315', 'Product Net Volume,in liters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('316', 'Product Net Volume,in cubic meters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('320', 'Product Net Weight,in pounds', 6, false, true),
new application_identifier_1.ApplicationIdentifier('321', 'Product Length/1st Dimension,in inches', 6, false, true),
new application_identifier_1.ApplicationIdentifier('322', 'Product Length/1st Dimension,in feet', 6, false, true),
new application_identifier_1.ApplicationIdentifier('323', 'Product Length/1st Dimension,in yards', 6, false, true),
new application_identifier_1.ApplicationIdentifier('324', 'Product Width/Diameter/2nd Dimension,in inches', 6, false, true),
new application_identifier_1.ApplicationIdentifier('325', 'Product Width/Diameter/2nd Dimension,in feet', 6, false, true),
new application_identifier_1.ApplicationIdentifier('326', 'Product Width/Diameter/2nd Dimension,in yards', 6, false, true),
new application_identifier_1.ApplicationIdentifier('327', 'Product Depth/Thickness/Height/3rd Dimension,in inches', 6, false, true),
new application_identifier_1.ApplicationIdentifier('328', 'Product Depth/Thickness/Height/3rd Dimension,in feet', 6, false, true),
new application_identifier_1.ApplicationIdentifier('329', 'Product Depth/Thickness/3rd Dimension,in yards', 6, false, true),
new application_identifier_1.ApplicationIdentifier('330', 'Container Gross Weight kg', 6, false, true),
new application_identifier_1.ApplicationIdentifier('331', 'Container Length/1st Dimension Meters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('332', 'Container Width/Diameter/2nd Dimension Meters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('333', 'Container Depth/Thickness/3rdDimension Meters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('334', 'Container Area Square Meters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('335', 'Container Gross Volume Liters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('336', 'Container Gross Volume(CubicMeters', 6, false, true),
new application_identifier_1.ApplicationIdentifier('340', 'Container Gross Weight(Pounds', 6, false, true),
new application_identifier_1.ApplicationIdentifier('341', 'Container Length/1stDimension,ininches', 6, false, true),
new application_identifier_1.ApplicationIdentifier('342', 'Container Length/1stDimension,infeet', 6, false, true),
new application_identifier_1.ApplicationIdentifier('343', 'Container Length/1stDimensionin,inyards', 6, false, true),
new application_identifier_1.ApplicationIdentifier('344', 'Container Width/Diameter/2nd Dimension,in inches', 6, false, true),
new application_identifier_1.ApplicationIdentifier('345', 'Container Width/Diameter/2nd Dimension,in feet', 6, false, true),
new application_identifier_1.ApplicationIdentifier('346', 'Container Width/Diameter/2nd Dimension,in yards', 6, false, true),
new application_identifier_1.ApplicationIdentifier('347', 'Container Depth/Thickness/Height/3rd Dimension,in inches', 6, false, true),
new application_identifier_1.ApplicationIdentifier('348', 'Container Depth/Thickness/Height/3rd Dimension,in feet', 6, false, true),
new application_identifier_1.ApplicationIdentifier('349', 'Container Depth/Thickness/Height/3rd Dimension,in yards', 6, false, true),
new application_identifier_1.ApplicationIdentifier('350', 'Product Area(SquareInches', 6, false, true),
new application_identifier_1.ApplicationIdentifier('351', 'Product Area(SquareFeet', 6, false, true),
new application_identifier_1.ApplicationIdentifier('352', 'Product Area(SquareYards', 6, false, true),
new application_identifier_1.ApplicationIdentifier('353', 'Container Area(SquareInches', 6, false, true),
new application_identifier_1.ApplicationIdentifier('354', 'Container Area(SquareFeet', 6, false, true),
new application_identifier_1.ApplicationIdentifier('355', 'Container Area(SquareYards', 6, false, true),
new application_identifier_1.ApplicationIdentifier('356', 'Net Weight(TroyOunces', 6, false, true),
new application_identifier_1.ApplicationIdentifier('357', 'Net Weight/Volume(Ounces', 6, false, true),
new application_identifier_1.ApplicationIdentifier('360', 'Product Volume(Quarts', 6, false, true),
new application_identifier_1.ApplicationIdentifier('361', 'Product Volume(Gallons', 6, false, true),
new application_identifier_1.ApplicationIdentifier('362', 'Container Gross Volume(Quarts', 6, false, true),
new application_identifier_1.ApplicationIdentifier('363', 'ContainerGrossVolume(U.S.Gallons', 6, false, true),
new application_identifier_1.ApplicationIdentifier('364', 'ProductVolume(CubicInches', 6, false, true),
new application_identifier_1.ApplicationIdentifier('365', 'ProductVolume(CubicFeet', 6, false, true),
new application_identifier_1.ApplicationIdentifier('366', 'ProductVolume(CubicYards', 6, false, true),
new application_identifier_1.ApplicationIdentifier('367', 'ContainerGrossVolume(CubicInches', 6, false, true),
new application_identifier_1.ApplicationIdentifier('368', 'ContainerGrossVolume(CubicFeet', 6, false, true),
new application_identifier_1.ApplicationIdentifier('369', 'ContainerGrossVolume(CubicYards', 6, false, true),
new application_identifier_1.ApplicationIdentifier('37', 'NumberofUnitsContained', 8, true),
new application_identifier_1.ApplicationIdentifier('390', 'Amount payable local currency)', 15, true, true),
new application_identifier_1.ApplicationIdentifier('391', 'Amount payable with ISO currency code', 18, true, true),
new application_identifier_1.ApplicationIdentifier('392', 'Amount payable per single item local currency', 15, true, true),
new application_identifier_1.ApplicationIdentifier('393', 'Amount payable persingle itemx with ISO currency code', 18, true, true),
new application_identifier_1.ApplicationIdentifier('400', 'Customer Purchase Order Number', 30, true),
new application_identifier_1.ApplicationIdentifier('401', 'Consignment Number', 30, true),
new application_identifier_1.ApplicationIdentifier('402', 'BillofLadingnumber', 17, false),
new application_identifier_1.ApplicationIdentifier('403', 'Routing code', 30, true),
new application_identifier_1.ApplicationIdentifier('410', 'ShipTo/DeliverToLocationCode(GlobalLocationNumber', 13, false),
new application_identifier_1.ApplicationIdentifier('411', 'BillTo/InvoiceLocationCode(GlobalLocationNumber', 13, false),
new application_identifier_1.ApplicationIdentifier('412', 'PurchaseFromLocationCode(GlobalLocationNumber', 13, false),
new application_identifier_1.ApplicationIdentifier('413', 'Shipfor,Deliver for,or Forward to Location Code', 13, false),
new application_identifier_1.ApplicationIdentifier('414', 'Identification of a physical location', 13, false),
new application_identifier_1.ApplicationIdentifier('420', 'ShipTo/DeliverToPostalCode', 20, true),
new application_identifier_1.ApplicationIdentifier('421', 'ShipTo/DeliverToPostalCode', 15, true),
new application_identifier_1.ApplicationIdentifier('422', 'Country of Origin', 3, false),
new application_identifier_1.ApplicationIdentifier('423', 'Country or countries of initial processing', 15, true),
new application_identifier_1.ApplicationIdentifier('424', 'Country of processing', 3, false),
new application_identifier_1.ApplicationIdentifier('425', 'Country of disassembly', 3, false),
new application_identifier_1.ApplicationIdentifier('426', 'Country of full process chain', 3, false),
new application_identifier_1.ApplicationIdentifier('7001', 'NATO Stock Number NSN', 13, false),
new application_identifier_1.ApplicationIdentifier('7002', 'UN/ECE Meat Carcasses and cuts classification', 30, true),
new application_identifier_1.ApplicationIdentifier('7003', 'expiration date and time', 10, false),
new application_identifier_1.ApplicationIdentifier('7004', 'Active Potency', 4, true),
new application_identifier_1.ApplicationIdentifier('703n', 'Processor approval', 30, true),
new application_identifier_1.ApplicationIdentifier('8001', 'Roll Products: Width/Length/CoreDiameter/Direction/Splices', 14, false),
new application_identifier_1.ApplicationIdentifier('8002', 'Mobile phone identifier', 20, true),
new application_identifier_1.ApplicationIdentifier('8003', 'Global ReturnableAssetIdentifier', 30, true),
new application_identifier_1.ApplicationIdentifier('8004', 'Global IndividualAssetIdentifier', 30, true),
new application_identifier_1.ApplicationIdentifier('8005', 'Price perUnitofMeasure', 6, false),
new application_identifier_1.ApplicationIdentifier('8006', 'identification of the components of an item', 18, false),
new application_identifier_1.ApplicationIdentifier('8007', 'International Bank Account Number', 30, true),
new application_identifier_1.ApplicationIdentifier('8008', 'Date/time of production', 12, true),
new application_identifier_1.ApplicationIdentifier('8018', 'Global ServiceRelationshipNumber', 18, false),
new application_identifier_1.ApplicationIdentifier('8020', 'Payment slip preference number', 25, true),
new application_identifier_1.ApplicationIdentifier('8100', 'CouponExtendedCode: Number System and Offer', 6, false),
new application_identifier_1.ApplicationIdentifier('8101', 'CouponExtendedCode: Number System,Offer,End of Offer', 10, false),
new application_identifier_1.ApplicationIdentifier('8102', 'CouponExtendedCode: Number System preceded by 0', 2, false),
new application_identifier_1.ApplicationIdentifier('8110', 'CouponcodeID(NorthAmerica', 30, true),
new application_identifier_1.ApplicationIdentifier('8200', 'Extended Packaging URL', 70, true),
new application_identifier_1.ApplicationIdentifier('90', 'Mutually Agreed Between Trading Partners', 30, true),
new application_identifier_1.ApplicationIdentifier('91', 'Internal Company Codes', 30, true),
new application_identifier_1.ApplicationIdentifier('92', 'Internal Company Codes', 30, true),
new application_identifier_1.ApplicationIdentifier('93', 'Internal Company Codes', 30, true),
new application_identifier_1.ApplicationIdentifier('94', 'Internal Company Codes', 30, true),
new application_identifier_1.ApplicationIdentifier('95', 'Internal Company Codes', 30, true),
new application_identifier_1.ApplicationIdentifier('96', 'Internal Company Codes', 30, true),
new application_identifier_1.ApplicationIdentifier('97', 'Internal Company Codes', 30, true),
new application_identifier_1.ApplicationIdentifier('98', 'Internal Company Codes', 30, true),
new application_identifier_1.ApplicationIdentifier('99', 'Internal Company Codes', 30, true),
var enums_1 = require("../enums");
var data = [
{
code: enums_1.AICode.SerialShippingContainerCode,
description: 'Serial Shipping Container Code',
length: 18,
variableLength: false,
},
{
code: enums_1.AICode.GTIN,
description: 'Global Trade Item Number',
length: 14,
variableLength: false,
},
{
code: enums_1.AICode.GTINContainer,
description: 'GTIN of Contained Trade Items',
length: 14,
variableLength: false,
},
{
code: enums_1.AICode.BatchLot,
description: 'Batch/Lot Number',
length: 20,
variableLength: true,
},
{
code: enums_1.AICode.ProductionDate,
description: 'Production Date',
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.DueDate,
description: 'DueDate',
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.PackagingDate,
description: 'Packaging Date',
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.BestBeforeDate,
description: 'Best Before Date YYMMDD',
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ExpirationDate,
description: 'Expiration Date',
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductVariant,
description: 'Product Variant',
length: 2,
variableLength: false,
},
{
code: enums_1.AICode.SerialNumber,
description: 'Serial Number',
length: 20,
variableLength: true,
},
{
code: enums_1.AICode.SecondaryDataFields,
description: 'Secondary Data Fields',
length: 29,
variableLength: true,
},
{
code: enums_1.AICode.LotnumberN,
description: 'Lot number[n]',
length: 19,
variableLength: true,
},
{
code: enums_1.AICode.AdditionalProductIdentification,
description: 'Additional Product Identification',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.CustomerPartNumber,
description: 'Customer Part Number',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.MadeToOrderVariationNumber,
description: 'Made-to-Order Variation Number',
length: 6,
variableLength: true,
},
{
code: enums_1.AICode.SecondarySerialNumber,
description: 'Secondary Serial Number',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.ReferencetoSourceEntity,
description: 'Reference to SourceEntity',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.GlobalDocumentTypeIdentifier,
description: 'Global Document Type Identifier',
length: 17,
variableLength: true,
},
{
code: enums_1.AICode.GLNExtensionComponent,
description: 'GLN Extension Component',
length: 20,
variableLength: true,
},
{
code: enums_1.AICode.GlobalCouponNumberGCN,
description: 'Global Coupon Number GCN',
length: 25,
variableLength: true,
},
{
code: enums_1.AICode.CountOfItems,
description: 'Count of items',
length: 8,
variableLength: true,
},
{
code: enums_1.AICode.ProductNetWeightKg,
description: 'Product Net Weight in kg',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductLength1stDimensionM,
description: 'Product Length/1st Dimension, in meters',
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductWidthDiameter2ndDimensionM,
description: 'Product Width/Diameter/2nd Dimension,in meters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductDepthThicknessHeight3rdDimensionM,
description: 'Product Depth/Thickness/Height/3rd Dimension,in meters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductAreaSqM,
description: 'Product Area,in square meters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductNetVolumeL,
description: 'Product Net Volume,in liters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductNetVolumeM,
description: 'Product Net Volume,in cubic meters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductNetWeightLbs,
description: 'Product Net Weight,in pounds',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductLength1stDimensionIn,
description: 'Product Length/1st Dimension,in inches',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductLength1stDimensionFt,
description: 'Product Length/1st Dimension,in feet',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductLength1stDimensionYd,
description: 'Product Length/1st Dimension,in yards',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductWidthDiameter2ndDimensionIn,
description: 'Product Width/Diameter/2nd Dimension,in inches',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductWidthDiameter2ndDimensionFt,
description: 'Product Width/Diameter/2nd Dimension,in feet',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductWidthDiameter2ndDimensionYd,
description: 'Product Width/Diameter/2nd Dimension,in yards',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductDepthThicknessHeight3rdDimensionIn,
description: 'Product Depth/Thickness/Height/3rd Dimension,in inches',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductDepthThicknessHeight3rdDimensionFt,
description: 'Product Depth/Thickness/Height/3rd Dimension,in feet',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductDepthThickness3rdDimensionYd,
description: 'Product Depth/Thickness/3rd Dimension,in yards',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerGrossWeightKg,
description: 'Container Gross Weight kg',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerLength1stDimensionM,
description: 'Container Length/1st Dimension Meters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerWidthDiameter2ndDimensionM,
description: 'Container Width/Diameter/2nd Dimension Meters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerDepthThickness3rdDimensionM,
description: 'Container Depth/Thickness/3rdDimension Meters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerAreaSqM,
description: 'Container Area Square Meters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerGrossVolumeL,
description: 'Container Gross Volume Liters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerGrossVolumeCubicM,
description: 'Container Gross Volume CubicMeters',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerGrossWeightLbs,
description: 'Container Gross Weight Pounds',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerLength1stDimensionIn,
description: 'Container Length1stDimension in inches',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerLength1stDimensionFt,
description: 'Container Length/1stDimension,infeet',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerLength1stDimensionYd,
description: 'Container Length/1stDimensionin,inyards',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerWidthDiameter2ndDimensionIn,
description: 'Container Width/Diameter/2nd Dimension,in inches',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerWidthDiameter2ndDimensionFt,
description: 'Container Width/Diameter/2nd Dimension,in feet',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerWidthDiameter2ndDimensionYd,
description: 'Container Width/Diameter/2nd Dimension,in yards',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerDepthThicknessHeight3rdDimensionIn,
description: 'Container Depth/Thickness/Height/3rd Dimension,in inches',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerDepthThicknessHeight3rdDimensionFt,
description: 'Container Depth/Thickness/Height/3rd Dimension,in feet',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerDepthThicknessHeight3rdDimensionYd,
description: 'Container Depth/Thickness/Height/3rd Dimension,in yards',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductAreaSqIn,
description: 'Product Area SquareInches',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductAreaSqFt,
description: 'Product Area SquareFeet',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductAreaSqYd,
description: 'Product Area SquareYards',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerAreaSqIn,
description: 'Container Area SquareInches',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerAreaSqFt,
description: 'Container Area SquareFeet',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerAreaSqYd,
description: 'Container Area SquareYards',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.NetWeightTroyOz,
description: 'Net Weight TroyOunces',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.NetWeightVolumeOz,
description: 'Net Weight/Volume Ounces',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductVolumeQt,
description: 'Product Volume Quarts',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductVolumeGal,
description: 'Product Volume Gallons',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerGrossVolumeQt,
description: 'Container Gross Volume Quarts',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerGrossVolumeUSGal,
description: 'ContainerGrossVolume U.S.Gallons',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductVolumeCubicIn,
description: 'ProductVolume CubicInches',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductVolumeCubicFt,
description: 'ProductVolume CubicFeet',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ProductVolumeCubicYd,
description: 'ProductVolume CubicYards',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerGRossVolumeCubicIn,
description: 'ContainerGrossVolume CubicInches',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerGrossVolumeCubicFt,
description: 'ContainerGrossVolume CubicFeet',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.ContainerGrossVolumeCubicYd,
description: 'ContainerGrossVolume CubicYards',
fractional: true,
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.NumberofUnitsContained,
description: 'NumberofUnitsContained',
length: 8,
variableLength: true,
},
{
code: enums_1.AICode.AmountPayableLocalCurrency,
description: 'Amount payable local currency}',
fractional: true,
length: 15,
variableLength: true,
},
{
code: enums_1.AICode.AmountPayableISOCurrencyCode,
description: 'Amount payable with ISO currency code',
fractional: true,
length: 18,
variableLength: true,
},
{
code: enums_1.AICode.AmountPayableSingleItemLocalCurrency,
description: 'Amount payable per single item local currency',
fractional: true,
length: 15,
variableLength: true,
},
{
code: enums_1.AICode.AmountPayableSingleItemxWithISOcurrencycode,
description: 'Amount payable per single itemx with ISO currency code',
fractional: true,
length: 18,
variableLength: true,
},
{
code: enums_1.AICode.CustomerPurchaseOrderNumber,
description: 'Customer Purchase Order Number',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.ConsignmentNumber,
description: 'Consignment Number',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.BillofLadingNumber,
description: 'BillofLadingnumber',
length: 17,
variableLength: false,
},
{
code: enums_1.AICode.RoutingCode,
description: 'Routing code',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.ShipToDeliverToLocationCodeGlobalLocationNumber,
description: 'ShipTo/DeliverToLocationCode GlobalLocationNumber',
length: 13,
variableLength: false,
},
{
code: enums_1.AICode.BillToInvoiceLocationCodeGlobalLocationNumber,
description: 'BillTo/InvoiceLocationCode GlobalLocationNumber',
length: 13,
variableLength: false,
},
{
code: enums_1.AICode.PurchaseFromLocationCodeGlobalLocationNumber,
description: 'PurchaseFromLocationCode GlobalLocationNumber',
length: 13,
variableLength: false,
},
{
code: enums_1.AICode.ShipForDeliverForOrForwardToLocationCode,
description: 'Shipfor,Deliver for,or Forward to Location Code',
length: 13,
variableLength: false,
},
{
code: enums_1.AICode.IdentificationOfAPhysicAllocation,
description: 'Identification of a physical location',
length: 13,
variableLength: false,
},
{
code: enums_1.AICode.ShipToDeliverToPostalCodeSinglePostalAuthority,
description: 'ShipTo /DeliverTo PostalCode Single Postal Authority',
length: 20,
variableLength: true,
},
{
code: enums_1.AICode.ShipToDeliverToPostalCodeISOCountryCode,
description: 'ShipTo / DeliverTo PostalCode ISO CountryCode',
length: 15,
variableLength: true,
},
{
code: enums_1.AICode.CountryofOrigin,
description: 'Country of Origin',
length: 3,
variableLength: false,
},
{
code: enums_1.AICode.CountryOrCountriesOfInitialProcessing,
description: 'Country or countries of initial processing',
length: 15,
variableLength: true,
},
{
code: enums_1.AICode.CountryOfProcessing,
description: 'Country of processing',
length: 3,
variableLength: false,
},
{
code: enums_1.AICode.CountryOfDisassembly,
description: 'Country of disassembly',
length: 3,
variableLength: false,
},
{
code: enums_1.AICode.CountryOfFullProcessChain,
description: 'Country of full process chain',
length: 3,
variableLength: false,
},
{
code: enums_1.AICode.NATOStockNumberNSN,
description: 'NATO Stock Number NSN',
length: 13,
variableLength: false,
},
{
code: enums_1.AICode.UNECEMeatCarcassesAndCutsClassification,
description: 'UN/ECE Meat Carcasses and cuts classification',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.ExpirationDateAndTime,
description: 'expiration date and time',
length: 10,
variableLength: false,
},
{
code: enums_1.AICode.ActivePotency,
description: 'Active Potency',
length: 4,
variableLength: true,
},
{
code: enums_1.AICode.HarvestDate,
description: 'Harvest Date',
length: 12,
variableLength: true,
},
{
code: enums_1.AICode.Processorapproval,
description: 'Processor approval',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.RollProductsWidthLengthCoreDiameterDirectionSplices,
description: 'Roll Products: Width/Length/CoreDiameter/Direction/Splices',
length: 14,
variableLength: false,
},
{
code: enums_1.AICode.MobilePhoneIdentifier,
description: 'Mobile phone identifier',
length: 20,
variableLength: true,
},
{
code: enums_1.AICode.GlobalReturnableAssetIdentifier,
description: 'Global ReturnableAssetIdentifier',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.GlobalIndividualAssetIdentifier,
description: 'Global IndividualAssetIdentifier',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.PriceperUnitofMeasure,
description: 'Price perUnitofMeasure',
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.IdentificationOfTheComponentsOfAnItem,
description: 'identification of the components of an item',
length: 18,
variableLength: false,
},
{
code: enums_1.AICode.InternationalBankAccountNumber,
description: 'International Bank Account Number',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.DatetimeOfProduction,
description: 'Date/time of production',
length: 12,
variableLength: true,
},
{
code: enums_1.AICode.GlobalServiceRelationshipNumber,
description: 'Global ServiceRelationshipNumber',
length: 18,
variableLength: false,
},
{
code: enums_1.AICode.PaymentSlipPreferenceNumber,
description: 'Payment slip preference number',
length: 25,
variableLength: true,
},
{
code: enums_1.AICode.CouponExtendedCodeNumberSystemandOffer,
description: 'CouponExtendedCode: Number System and Offer',
length: 6,
variableLength: false,
},
{
code: enums_1.AICode.CouponExtendedCodeNumberSystemOfferEndofOffer,
description: 'CouponExtendedCode: Number System,Offer,End of Offer',
length: 10,
variableLength: false,
},
{
code: enums_1.AICode.CouponExtendedCodeNumberSystemPrecededBy0,
description: 'CouponExtendedCode: Number System preceded by 0',
length: 2,
variableLength: false,
},
{
code: enums_1.AICode.CouponcodeIDNorthAmerica,
description: 'CouponcodeID NorthAmerica',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.ExtendedPackagingURL,
description: 'Extended Packaging URL',
length: 70,
variableLength: true,
},
{
code: enums_1.AICode.MutuallyAgreedBetweenTradingPartners,
description: 'Mutually Agreed Between Trading Partners',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.InternalCompanyCodes91,
description: 'Internal Company Codes',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.InternalCompanyCodes92,
description: 'Internal Company Codes',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.InternalCompanyCodes93,
description: 'Internal Company Codes',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.InternalCompanyCodes94,
description: 'Internal Company Codes',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.InternalCompanyCodes95,
description: 'Internal Company Codes',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.InternalCompanyCodes96,
description: 'Internal Company Codes',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.InternalCompanyCodes97,
description: 'Internal Company Codes',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.InternalCompanyCodes98,
description: 'Internal Company Codes',
length: 30,
variableLength: true,
},
{
code: enums_1.AICode.InternalCompanyCodes99,
description: 'Internal Company Codes',
length: 30,
variableLength: true,
},
];
exports.APPLICATION_IDENTIFIERS = data.map(function (x) { return new application_identifier_1.ApplicationIdentifier(x.code, x.description, x.length, x.variableLength, x.fractional); });
//# sourceMappingURL=application-identifiers.js.map
import { IBarcodeValue } from './ibarcode-value';
import { AICode } from '../enums';
export declare class BarcodeValue implements IBarcodeValue {

@@ -10,12 +11,15 @@ private _symbology;

constructor(_symbology: string, _rawValue: string);
symbology: string;
rawValue: string;
values: any;
errorMessage: string;
success: boolean;
checkDigit: number;
readonly isWeightBased: boolean;
readonly systemId: string;
readonly systemMeasure: number;
pluck(valueKey: string): any;
get symbology(): string;
set symbology(value: string);
get rawValue(): string;
set rawValue(value: string);
get values(): any;
set values(value: any);
get errorMessage(): string;
set errorMessage(value: string);
get success(): boolean;
set success(value: boolean);
get checkDigit(): number;
set checkDigit(value: number);
pluck(valueKey: string | AICode): any;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var symbologies_1 = require("../config/symbologies");
exports.BarcodeValue = void 0;
var BarcodeValue = /** @class */ (function () {

@@ -19,3 +19,3 @@ function BarcodeValue(_symbology, _rawValue) {

},
enumerable: true,
enumerable: false,
configurable: true

@@ -30,3 +30,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -41,3 +41,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -52,3 +52,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -63,3 +63,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -74,40 +74,8 @@ });

},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(BarcodeValue.prototype, "isWeightBased", {
get: function () {
var checkOne = this.symbology === symbologies_1.Symbologies.GTIN13;
var checkTwo = typeof this.values;
var checkThree = this.values.slice(0, 1) === '2';
return checkOne && checkTwo === 'string' && checkThree;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BarcodeValue.prototype, "systemId", {
get: function () {
if (this.isWeightBased === true) {
return this._values.substring(1, 6);
}
return null;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BarcodeValue.prototype, "systemMeasure", {
get: function () {
if (this.isWeightBased === true) {
return parseFloat(this._values.substring(7, 12)) / 100;
}
return null;
},
enumerable: true,
configurable: true
});
BarcodeValue.prototype.pluck = function (valueKey) {
if (this.values !== undefined && this.values instanceof Array) {
var result = this.values.filter(function (r) {
return r.code === valueKey;
});
var result = this.values.filter(function (r) { return r.code === valueKey; });
if (result[0]) {

@@ -114,0 +82,0 @@ return result[0].value;

@@ -8,6 +8,3 @@ export interface IBarcodeValue {

checkDigit: number;
isWeightBased: boolean;
systemId: string;
systemMeasure: number;
pluck(valueKey: string): any;
}
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./application-identifier"));
__export(require("./application-identifiers"));
__export(require("./barcode-value"));
__exportStar(require("./application-identifier"), exports);
__exportStar(require("./application-identifiers"), exports);
__exportStar(require("./barcode-value"), exports);
__exportStar(require("./embedded-data"), exports);
__exportStar(require("./ibarcode-value"), exports);
__exportStar(require("./parser.configuration"), exports);
__exportStar(require("./reader.configuration"), exports);
//# sourceMappingURL=index.js.map

@@ -5,2 +5,3 @@ import { IReaderConfiguration } from './reader.configuration';

readerConfigurations: IReaderConfiguration[];
verbose?: boolean;
}
import { IEmbeddedData } from './embedded-data';
export interface IReaderConfiguration {
symbology: string;
delimiter: string;
identifier: string;
values: IEmbeddedData[];
delimiter?: string;
identifier?: string;
values?: IEmbeddedData[];
}

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,2 +17,3 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseGtinReader = void 0;
var base_reader_1 = require("./base.reader");

@@ -19,0 +20,0 @@ var utils_1 = require("../utils");

@@ -7,5 +7,5 @@ import { IBarcodeValue, IReaderConfiguration } from '../models';

constructor(_symbology: string, _validationExpression: RegExp, _readerConfig: IReaderConfiguration);
readonly configuration: IReaderConfiguration;
readonly symbology: string;
readonly validationExpression: RegExp;
get configuration(): IReaderConfiguration;
get symbology(): string;
get validationExpression(): RegExp;
validate(value: string): boolean;

@@ -12,0 +12,0 @@ abstract decode(value: string): IBarcodeValue;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseReader = void 0;
var BaseReader = /** @class */ (function () {

@@ -13,3 +14,3 @@ function BaseReader(_symbology, _validationExpression, _readerConfig) {

},
enumerable: true,
enumerable: false,
configurable: true

@@ -21,3 +22,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -29,3 +30,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -32,0 +33,0 @@ });

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,5 +17,7 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Code128Reader = void 0;
var base_reader_1 = require("./base.reader");
var models_1 = require("../models");
var config_1 = require("../config");
var enums_1 = require("../enums");
var utils_1 = require("../utils");

@@ -26,6 +28,6 @@ var DELIMITER = ' ';

function Code128Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.Code128, null, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.Code128, null, readerConfig) || this;
}
Code128Reader.prototype.validate = function (value) {
var idPrefix = value.indexOf(config_1.AimCodes.CODE128);
var idPrefix = value.indexOf(enums_1.AimCodes.CODE128);
var valueLength = utils_1.AimParser.parseAimCode(this.symbology, value)

@@ -32,0 +34,0 @@ .length;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,42 +17,15 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Code39Reader = void 0;
var base_reader_1 = require("./base.reader");
var models_1 = require("../models");
var config_1 = require("../config");
var enums_1 = require("../enums");
var utils_1 = require("../utils");
var REG = /^[A-Z0-9* \-$%.+\/]{1,43}$/;
// todo this should probably eventually move into host app
var defaultConfig = {
values: [
{
length: 1,
start: 0,
valueType: 'documentType',
},
{
length: 2,
start: -4,
valueType: 'companyId',
},
{
length: 2,
start: -2,
valueType: 'locationId',
},
{
length: 9,
start: 1,
valueType: 'documentId',
},
],
};
var Code39Reader = /** @class */ (function (_super) {
__extends(Code39Reader, _super);
function Code39Reader(readerConfig) {
var _this = this;
var config = readerConfig || defaultConfig;
_this = _super.call(this, config_1.Symbologies.Code39, REG, config) || this;
return _this;
return _super.call(this, enums_1.Symbologies.Code39, REG, readerConfig) || this;
}
Code39Reader.prototype.validate = function (value) {
var aimPrefix = value.indexOf(config_1.AimCodes.CODE39);
var aimPrefix = value.indexOf(enums_1.AimCodes.CODE39);
return (aimPrefix === 0 &&

@@ -62,6 +35,16 @@ _super.prototype.validate.call(this, utils_1.AimParser.parseAimCode(this.symbology, value)));

Code39Reader.prototype.decode = function (value) {
var _a, _b;
var result = new models_1.BarcodeValue(this.symbology, value);
try {
this.tryValidate(value);
result.values = utils_1.AimParser.parseAimCode(this.symbology, value);
var parsedVal_1 = utils_1.AimParser.parseAimCode(this.symbology, value);
if (!((_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.length)) {
result.values = parsedVal_1;
}
else {
result.values = this.configuration.values.map(function (ed) { return ({
code: ed.valueType,
value: parsedVal_1.substr(ed.start, ed.length),
}); });
}
}

@@ -68,0 +51,0 @@ catch (ex) {

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Ean13Reader = void 0;
var base_gtin_reader_1 = require("./base-gtin.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var REG = /^\]E0[0-9]{13,13}$/;

@@ -24,3 +25,3 @@ var Ean13Reader = /** @class */ (function (_super) {

function Ean13Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.GTIN13, REG, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.GTIN13, REG, readerConfig) || this;
}

@@ -27,0 +28,0 @@ return Ean13Reader;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Ean8Reader = void 0;
var base_gtin_reader_1 = require("./base-gtin.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var REG = /^\]E4[0-9]{8,8}$/;

@@ -24,3 +25,3 @@ var Ean8Reader = /** @class */ (function (_super) {

function Ean8Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.GTIN8, REG, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.GTIN8, REG, readerConfig) || this;
}

@@ -27,0 +28,0 @@ return Ean8Reader;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,5 +17,7 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.GS1Reader = void 0;
var base_reader_1 = require("./base.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var models_1 = require("../models");
var config_1 = require("../config");
var utils_1 = require("../utils");

@@ -26,6 +28,6 @@ var DELIMITER = ' ';

function GS1Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.GS1128, null, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.GS1128, null, readerConfig) || this;
}
GS1Reader.prototype.validate = function (value) {
var idPrefix = value.indexOf(config_1.AimCodes.GS1);
var idPrefix = value.indexOf(enums_1.AimCodes.GS1);
var valueLength = utils_1.AimParser.parseAimCode(this.symbology, value)

@@ -32,0 +34,0 @@ .length;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Gtin12Reader = void 0;
var base_gtin_reader_1 = require("./base-gtin.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var REG = /^\]E0[0-9]{12,12}$/;

@@ -24,3 +25,3 @@ var Gtin12Reader = /** @class */ (function (_super) {

function Gtin12Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.GTIN12, REG, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.GTIN12, REG, readerConfig) || this;
}

@@ -27,0 +28,0 @@ return Gtin12Reader;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Gtin13Reader = void 0;
var base_gtin_reader_1 = require("./base-gtin.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var REG = /^\]E0[0-9]{13,13}$/;

@@ -24,3 +25,3 @@ var Gtin13Reader = /** @class */ (function (_super) {

function Gtin13Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.GTIN13, REG, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.GTIN13, REG, readerConfig) || this;
}

@@ -27,0 +28,0 @@ return Gtin13Reader;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Gtin14Reader = void 0;
var base_gtin_reader_1 = require("./base-gtin.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var REG = /^\]E0[0-9]{14,14}$/;

@@ -24,3 +25,3 @@ var Gtin14Reader = /** @class */ (function (_super) {

function Gtin14Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.GTIN14, REG, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.GTIN14, REG, readerConfig) || this;
}

@@ -27,0 +28,0 @@ return Gtin14Reader;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Gtin8Reader = void 0;
var base_gtin_reader_1 = require("./base-gtin.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var REG = /^\]E4[0-9]{8,8}$/;

@@ -24,3 +25,3 @@ var Gtin8Reader = /** @class */ (function (_super) {

function Gtin8Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.GTIN8, REG, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.GTIN8, REG, readerConfig) || this;
}

@@ -27,0 +28,0 @@ return Gtin8Reader;

@@ -14,9 +14,9 @@ import { Code39Reader } from './code-39.reader';

import { Ean8Reader } from './ean-8.reader';
export { Code39Reader, Code128Reader, Ean8Reader, Ean13Reader, Gtin8Reader, Gtin12Reader, Gtin13Reader, Gtin14Reader, GS1Reader, Itf8Reader, Itf12Reader, Itf13Reader, Itf14Reader, };
export { Code128Reader, Code39Reader, Ean8Reader, Ean13Reader, Gtin8Reader, Gtin12Reader, Gtin13Reader, Gtin14Reader, GS1Reader, Itf8Reader, Itf12Reader, Itf13Reader, Itf14Reader, };
export declare const READERS: (typeof Code39Reader)[];
export declare const READER_TYPES: {
code_128: typeof Code128Reader;
code_39: typeof Code39Reader;
code_128: typeof Code128Reader;
ean_13: typeof Ean13Reader;
ean_8: typeof Ean8Reader;
ean_13: typeof Ean13Reader;
gs1_128: typeof GS1Reader;

@@ -23,0 +23,0 @@ gtin_12: typeof Gtin12Reader;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.READER_TYPES = exports.READERS = exports.Itf14Reader = exports.Itf13Reader = exports.Itf12Reader = exports.Itf8Reader = exports.GS1Reader = exports.Gtin14Reader = exports.Gtin13Reader = exports.Gtin12Reader = exports.Gtin8Reader = exports.Ean13Reader = exports.Ean8Reader = exports.Code39Reader = exports.Code128Reader = void 0;
var code_39_reader_1 = require("./code-39.reader");
exports.Code39Reader = code_39_reader_1.Code39Reader;
Object.defineProperty(exports, "Code39Reader", { enumerable: true, get: function () { return code_39_reader_1.Code39Reader; } });
var gtin_8_reader_1 = require("./gtin-8.reader");
exports.Gtin8Reader = gtin_8_reader_1.Gtin8Reader;
Object.defineProperty(exports, "Gtin8Reader", { enumerable: true, get: function () { return gtin_8_reader_1.Gtin8Reader; } });
var gtin_12_reader_1 = require("./gtin-12.reader");
exports.Gtin12Reader = gtin_12_reader_1.Gtin12Reader;
Object.defineProperty(exports, "Gtin12Reader", { enumerable: true, get: function () { return gtin_12_reader_1.Gtin12Reader; } });
var gtin_13_reader_1 = require("./gtin-13.reader");
exports.Gtin13Reader = gtin_13_reader_1.Gtin13Reader;
Object.defineProperty(exports, "Gtin13Reader", { enumerable: true, get: function () { return gtin_13_reader_1.Gtin13Reader; } });
var gtin_14_reader_1 = require("./gtin-14.reader");
exports.Gtin14Reader = gtin_14_reader_1.Gtin14Reader;
Object.defineProperty(exports, "Gtin14Reader", { enumerable: true, get: function () { return gtin_14_reader_1.Gtin14Reader; } });
var gs_1_reader_1 = require("./gs-1.reader");
exports.GS1Reader = gs_1_reader_1.GS1Reader;
Object.defineProperty(exports, "GS1Reader", { enumerable: true, get: function () { return gs_1_reader_1.GS1Reader; } });
var itf_8_reader_1 = require("./itf-8.reader");
exports.Itf8Reader = itf_8_reader_1.Itf8Reader;
Object.defineProperty(exports, "Itf8Reader", { enumerable: true, get: function () { return itf_8_reader_1.Itf8Reader; } });
var itf_12_reader_1 = require("./itf-12.reader");
exports.Itf12Reader = itf_12_reader_1.Itf12Reader;
Object.defineProperty(exports, "Itf12Reader", { enumerable: true, get: function () { return itf_12_reader_1.Itf12Reader; } });
var itf_13_reader_1 = require("./itf-13.reader");
exports.Itf13Reader = itf_13_reader_1.Itf13Reader;
Object.defineProperty(exports, "Itf13Reader", { enumerable: true, get: function () { return itf_13_reader_1.Itf13Reader; } });
var itf_14_reader_1 = require("./itf-14.reader");
exports.Itf14Reader = itf_14_reader_1.Itf14Reader;
Object.defineProperty(exports, "Itf14Reader", { enumerable: true, get: function () { return itf_14_reader_1.Itf14Reader; } });
var code_128_reader_1 = require("./code-128.reader");
exports.Code128Reader = code_128_reader_1.Code128Reader;
Object.defineProperty(exports, "Code128Reader", { enumerable: true, get: function () { return code_128_reader_1.Code128Reader; } });
var ean_13_reader_1 = require("./ean-13.reader");
exports.Ean13Reader = ean_13_reader_1.Ean13Reader;
Object.defineProperty(exports, "Ean13Reader", { enumerable: true, get: function () { return ean_13_reader_1.Ean13Reader; } });
var ean_8_reader_1 = require("./ean-8.reader");
exports.Ean8Reader = ean_8_reader_1.Ean8Reader;
Object.defineProperty(exports, "Ean8Reader", { enumerable: true, get: function () { return ean_8_reader_1.Ean8Reader; } });
exports.READERS = [
code_128_reader_1.Code128Reader,
code_39_reader_1.Code39Reader,
code_128_reader_1.Code128Reader,
ean_8_reader_1.Ean8Reader,

@@ -45,6 +46,6 @@ ean_13_reader_1.Ean13Reader,

exports.READER_TYPES = {
code_128: code_128_reader_1.Code128Reader,
code_39: code_39_reader_1.Code39Reader,
code_128: code_128_reader_1.Code128Reader,
ean_13: ean_13_reader_1.Ean13Reader,
ean_8: ean_8_reader_1.Ean8Reader,
ean_13: ean_13_reader_1.Ean13Reader,
gs1_128: gs_1_reader_1.GS1Reader,

@@ -51,0 +52,0 @@ gtin_12: gtin_12_reader_1.Gtin12Reader,

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Itf12Reader = void 0;
var base_gtin_reader_1 = require("./base-gtin.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var REG = /^\]I0[0-9]{12,12}$/;

@@ -24,3 +25,3 @@ var Itf12Reader = /** @class */ (function (_super) {

function Itf12Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.ITF12, REG, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.ITF12, REG, readerConfig) || this;
}

@@ -27,0 +28,0 @@ return Itf12Reader;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Itf13Reader = void 0;
var base_gtin_reader_1 = require("./base-gtin.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var REG = /^\]I0[0-9]{13,13}$/;

@@ -24,3 +25,3 @@ var Itf13Reader = /** @class */ (function (_super) {

function Itf13Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.ITF13, REG, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.ITF13, REG, readerConfig) || this;
}

@@ -27,0 +28,0 @@ return Itf13Reader;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Itf14Reader = void 0;
var base_gtin_reader_1 = require("./base-gtin.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var REG = /^\]I0[0-9]{14,14}$/;

@@ -24,3 +25,3 @@ var Itf14Reader = /** @class */ (function (_super) {

function Itf14Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.ITF14, REG, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.ITF14, REG, readerConfig) || this;
}

@@ -27,0 +28,0 @@ return Itf14Reader;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -17,4 +17,5 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Itf8Reader = void 0;
var base_gtin_reader_1 = require("./base-gtin.reader");
var config_1 = require("../config");
var enums_1 = require("../enums");
var REG = /^\]I0[0-9]{8,8}$/;

@@ -24,3 +25,3 @@ var Itf8Reader = /** @class */ (function (_super) {

function Itf8Reader(readerConfig) {
return _super.call(this, config_1.Symbologies.ITF8, REG, readerConfig) || this;
return _super.call(this, enums_1.Symbologies.ITF8, REG, readerConfig) || this;
}

@@ -27,0 +28,0 @@ return Itf8Reader;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var config_1 = require("./../config");
exports.AimParser = void 0;
var enums_1 = require("./../enums");
var AimParser = /** @class */ (function () {

@@ -9,24 +10,24 @@ function AimParser() {

switch (symbology) {
case config_1.Symbologies.GTIN8:
return value.replace(config_1.AimCodes.GTIN, '');
case config_1.Symbologies.GTIN12:
return value.replace(config_1.AimCodes.GTIN, '');
case config_1.Symbologies.GTIN13:
return value.replace(config_1.AimCodes.GTIN, '');
case config_1.Symbologies.GTIN14:
return value.replace(config_1.AimCodes.GTIN, '');
case config_1.Symbologies.ITF8:
return value.replace(config_1.AimCodes.ITF, '');
case config_1.Symbologies.ITF12:
return value.replace(config_1.AimCodes.ITF, '');
case config_1.Symbologies.ITF13:
return value.replace(config_1.AimCodes.ITF, '');
case config_1.Symbologies.ITF14:
return value.replace(config_1.AimCodes.ITF, '');
case config_1.Symbologies.GS1128:
return value.replace(config_1.AimCodes.GS1, '');
case config_1.Symbologies.Code39:
return value.replace(config_1.AimCodes.CODE39, '');
case config_1.Symbologies.Code128:
return value.replace(config_1.AimCodes.CODE128, '');
case enums_1.Symbologies.GTIN8:
return value.replace(enums_1.AimCodes.GTIN, '');
case enums_1.Symbologies.GTIN12:
return value.replace(enums_1.AimCodes.GTIN, '');
case enums_1.Symbologies.GTIN13:
return value.replace(enums_1.AimCodes.GTIN, '');
case enums_1.Symbologies.GTIN14:
return value.replace(enums_1.AimCodes.GTIN, '');
case enums_1.Symbologies.ITF8:
return value.replace(enums_1.AimCodes.ITF, '');
case enums_1.Symbologies.ITF12:
return value.replace(enums_1.AimCodes.ITF, '');
case enums_1.Symbologies.ITF13:
return value.replace(enums_1.AimCodes.ITF, '');
case enums_1.Symbologies.ITF14:
return value.replace(enums_1.AimCodes.ITF, '');
case enums_1.Symbologies.GS1128:
return value.replace(enums_1.AimCodes.GS1, '');
case enums_1.Symbologies.Code39:
return value.replace(enums_1.AimCodes.CODE39, '');
case enums_1.Symbologies.Code128:
return value.replace(enums_1.AimCodes.CODE128, '');
default:

@@ -33,0 +34,0 @@ return value;

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./aim-parser"));
__exportStar(require("./aim-parser"), exports);
//# sourceMappingURL=index.js.map
{
"name": "barcode-parser",
"version": "1.3.0",
"description": "This project started out as a straight port of the Quagga project - https://serratus.github.io/quaggaJS. - to typescript however it has significantly diverged.",
"version": "2.1.0",
"description": "This project started out as a Typescript port of the Quagga project - https://serratus.github.io/quaggaJS. - but that direction has diverged greatly. This library does not read barcodes but rather parses the value returned by a dedicated barcode scanner.",
"repository": "git@github.com:stonelasley/barcode-parsing.git",

@@ -19,2 +19,5 @@ "typings": "lib/index.d.ts",

"lint": "tslint -c tslint.json 'src/**/*.ts'",
"lint:fix": "tslint -c tslint.json --fix 'src/**/*.ts'",
"ci": "yarn lint && yarn test",
"ci:afterSuccess": "yarn coverage && yarn release",
"release": "semantic-release"

@@ -25,14 +28,16 @@ },

"devDependencies": {
"@semantic-release/changelog": "^2.1.1",
"@semantic-release/git": "^6.0.1",
"@semantic-release/github": "^4.2.18",
"@types/jest": "^23.3.12",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.2",
"@semantic-release/npm": "^8.0.3",
"@types/jest": "^26.0.14",
"coveralls": "^3.0.1",
"cz-conventional-changelog": "^2.1.0",
"jest": "^23.6.0",
"jest": "^26.4.2",
"prettier": "1.15.3",
"semantic-release": "^15.6.0",
"ts-jest": "^23.10.5",
"semantic-release": "^17.2.3",
"ts-jest": "^26.4.0",
"tslint": "^5.10.0",
"typescript": "^3.2.4"
"typescript": "^4.0.3"
},

@@ -44,23 +49,3 @@ "config": {

},
"dependencies": {},
"release": {
"branch": "master",
"verifyConditions": [
"@semantic-release/changelog",
"@semantic-release/git",
"@semantic-release/github"
],
"prepare": [
{
"path": "@semantic-release/changelog",
"changelogFile": "./CHANGELOG.md"
},
"@semantic-release/git",
"@semantic-release/npm"
],
"publish": [
"@semantic-release/npm",
"@semantic-release/github"
]
}
"dependencies": {}
}
[![Coverage Status](https://coveralls.io/repos/github/stonelasley/barcode-parsing/badge.svg?branch=master)](https://coveralls.io/github/stonelasley/barcode-parsing?branch=master)
[![Build Status](https://travis-ci.org/stonelasley/barcode-parsing.svg?branch=master)](https://travis-ci.org/stonelasley/barcode-parsing)
[![Lint Test and Release](https://github.com/stonelasley/barcode-parsing/actions/workflows/test-release.yml/badge.svg)](https://github.com/stonelasley/barcode-parsing/actions/workflows/test-release.yml)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

@@ -19,68 +19,98 @@ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

],
readerConfigurations: []
readerConfigurations: [
{
symbology: Symbologies.Code39,
values: [
{
length: 2,
start: 0,
valueType: 'foo'
},
{
length: 3,
start: 2,
valueType: 'bar'
}
]
}
]
});
barcodeParser.parse(']I010734074010258');
barcodeParser.parse(']C100111111111111111111101234 30100 310600100');
barcodeParser.parse(']Z00000000');
```
** please note the input above with spaces would never be valid from a scanner, the spaces would instead be an invisible [group seperator](http://www.theasciicode.com.ar/ascii-control-characters/group-separator-ascii-code-29.html). This library replaces the GS character with a space before parsing so it works for both illustrative purposes and testing.
### Results
`]I010734074010258`
const itfResult = barcodeParser.parse(']I010734074010258');
// {
// symbology: 'itf_14',
// rawValue: ']I010734074010258',
// checkDigit: 8,
// success: true,
// values: '1073407401025'
// }
```json
"barcodeVal": {
"_symbology": "itf_14",
"_rawValue": "]I010734074010258",
"_checkDigit": 8,
"_success": true,
"_values": "1073407401025"
// the below input with spaces would never be valid from a scanner, the spaces would instead be an invisible [group seperator](http://www.theasciicode.com.ar/ascii-control-characters/group-separator-ascii-code-29.html). This library replaces the GS character with a space before parsing so it works for both illustrative purposes and testing.
const code128Result = barcodeParser.parse(']C100111111111111111111101234 30100 310600100');
code128Result.pluck(AICode.BatchLot) // '1234'
code128Result.pluck(AICode.SerialShippingContainerCode) // '111111111111111111'
code128Result.pluck(AICode.CountOfItems) // '100'
code128Result.pluck(AICode.ProductNetWeightKg) // .0001
// {
// symbology: 'gs1_128',
// rawValue: ']C100111111111111111111101234 30100 310600100',
// checkDigit: -1,
// success: true,
// values: [
// {
// code: '10',
// value: '1234'
// },
// {
// code: '00',
// value: '111111111111111111'
// },
// {
// code: '30',
// value: '100'
// },
// {
// 'code': '310',
// 'value': 0.0001
// }
// ]
// }
const code39Result = barcodeParser.parse(']A01234567777777');
code39Result.success // true
code39Result.errorMessage // undefined
code39Result.pluck('foo') // '12'
code39Result.pluck('bar') // '345'
code39Result.pluck('bizz') // undefined
{
symbology: 'code_39',
rawValue: ']A01234567777777',
checkDigit: -1,
success: true,
values: [
{
code: 'foo',
value: '12'
},
{
code: 'bar',
value: '345'
}
]
}
```
`]C100111111111111111111101234 30100 310600100`
```json
"barcodeVal": {
"_symbology": "gs1_128",
"_rawValue": "]C100111111111111111111101234 30100 310600100",
"_checkDigit": -1,
"_success": true,
"_values": [
{
"code": "10",
"value": "1234"
},
{
"code": "00",
"value": "111111111111111111"
},
{
"code": "30",
"value": "100"
},
{
"code": "310",
"value": 0.0001
}
]
}
const invalidInputResult = barcodeParser.parse(']Z00000000');
invalidInputResult.success // false
invalidInputResult.errorMessage // 'No Reader Found'
// {
// symbology: null,
// rawValue: ']Z00000000',
// checkDigit: -1,
// success: false,
// values: [],
// errorMessage: 'No Reader Found'
// }
```
`]Z00000000`
```json
"barcodeVal": {
"_symbology": null,
"_rawValue": "]Z00000000",
"_checkDigit": -1,
"_success": false,
"_values": [],
"_errorMessage": "No Reader Found"
}
```
#### Roadmap
- This package as it stands is very much a "good enough" for what we needed it for but it needs a little work before it can be used easily in an arbitrary project.
- Reader Specific Configurations. See Code39.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc