diff --git a/package-lock.json b/package-lock.json index 91867a4..0fa2b1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "physical-barcode-reader-observer", - "version": "2.0.4", + "version": "2.0.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1684beb..ee9f840 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "physical-barcode-reader-observer", - "version": "2.0.4", + "version": "2.0.5", "description": "Library which observe keyboard input events to listen HID barcode reader events", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/__tests__/barcode-type-detector.test.ts b/src/__tests__/barcode-type-detector.test.ts index b3b1fca..0b1a3d1 100644 --- a/src/__tests__/barcode-type-detector.test.ts +++ b/src/__tests__/barcode-type-detector.test.ts @@ -1,4 +1,4 @@ -import {BarcodeTypeDetector} from '../barcode-type-detector'; +import { BarcodeTypeDetector } from '../barcode-type-detector'; import { BarcodeType } from '../enums'; test('EAN_13 Validation', () => { diff --git a/src/barcode-type-detector.ts b/src/barcode-type-detector.ts index a1faaa3..39dceb8 100644 --- a/src/barcode-type-detector.ts +++ b/src/barcode-type-detector.ts @@ -23,13 +23,13 @@ const isOnlyDigits = (value: string, length: number): boolean => onlyDigitsRegex */ const getEanControlKey = (value: string): number => { const sumCtrl = value - .slice(0, value.length - 1) - .split('') - // Chars are only digits - .map(digit => parseInt(digit, 10)) - // Each even char column index is multiply by 3 - // And we make the sum - .reduce((acc, digit, index) => acc + ((index % 2) ? digit : (digit * 3)), 0); + .slice(0, value.length - 1) + .split('') + // Chars are only digits + .map(digit => parseInt(digit, 10)) + // Each even char column index is multiply by 3 + // And we make the sum + .reduce((acc, digit, index) => acc + (index % 2 ? digit : digit * 3), 0); return 10 - (sumCtrl % 10); }; /**