Skip to content

Commit

Permalink
feat(EAN): EAN 8/13 support
Browse files Browse the repository at this point in the history
  • Loading branch information
stonelasley committed Jan 23, 2019
1 parent a7a2231 commit 73adacc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/__tests__/readers/ean-13.reader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ describe('Ean13Reader', () => {
describe('validate', () => {
test('should validate value length', () => {
/* tslint:disable */
expect(classUnderTest['validate'](']E41111111111111')).toBe(true);
expect(classUnderTest['validate'](']E411111111111111')).toBe(false);
expect(classUnderTest['validate'](']E411111')).toBe(false);
expect(classUnderTest['validate'](']E01111111111111')).toBe(true);
expect(classUnderTest['validate'](']E011111111111111')).toBe(false);
expect(classUnderTest['validate'](']E011111')).toBe(false);
/* tslint:enable */
});

test('should validate character type', () => {
/* tslint:disable */
expect(classUnderTest['validate'](']E41111111111111')).toBe(true);
expect(classUnderTest['validate'](']E4aaaaaaaaaaaaa')).toBe(false);
expect(classUnderTest['validate'](']E01111111111111')).toBe(true);
expect(classUnderTest['validate'](']E0aaaaaaaaaaaaa')).toBe(false);
/* tslint:enable */
});
});
Expand Down
8 changes: 6 additions & 2 deletions src/readers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,44 @@ import { Itf13Reader } from './itf-13.reader';
import { Itf14Reader } from './itf-14.reader';
import { Code128Reader } from './code-128.reader';
import { Ean13Reader } from './ean-13.reader';
import { Ean8Reader } from './ean-8.reader';

export {
Code39Reader,
Code128Reader,
Ean8Reader,
Ean13Reader,
Gtin8Reader,
Gtin12Reader,
Gtin13Reader,
Gtin14Reader,
GS1Reader,
Itf8Reader,
Itf12Reader,
Itf13Reader,
Itf14Reader,
GS1Reader,
};

export const READERS = [
Code39Reader,
Code128Reader,
Ean8Reader,
Ean13Reader,
Gtin8Reader,
Gtin12Reader,
Gtin13Reader,
Gtin14Reader,
GS1Reader,
Itf8Reader,
Itf12Reader,
Itf13Reader,
Itf14Reader,
GS1Reader,
];

export const READER_TYPES = {
code_39: Code39Reader,
code_128: Code128Reader,
ean_8: Ean8Reader,
ean_13: Ean13Reader,
gs1_128: GS1Reader,
gtin_12: Gtin12Reader,
Expand Down

0 comments on commit 73adacc

Please sign in to comment.