import BitArray from '../common/BitArray' ; import AbstractUPCEANReader from './AbstractUPCEANReader' ; import UPCEANExtension5Support from './UPCEANExtension5Support' ; import UPCEANExtension2Support from './UPCEANExtension2Support' ; import Result from '../Result' ; export default class UPCEANExtensionSupport { private static EXTENSION_START_PATTERN = Int32Array . from ( [ 1 , 1 , 2 ] ) ; static decodeRow ( rowNumber , row , rowOffset ) { let extensionStartRange = AbstractUPCEANReader . findGuardPattern ( row , rowOffset , false , this . EXTENSION_START_PATTERN , new Int32Array ( this . EXTENSION_START_PATTERN . length ) . fill ( 0 ) ) ; try { let fiveSupport = new UPCEANExtension5Support ( ) ; return fiveSupport . decodeRow ( rowNumber , row , extensionStartRange ) ; } catch ( err ) { let twoSupport = new UPCEANExtension2Support ( ) ; return twoSupport . decodeRow ( rowNumber , row , extensionStartRange ) ; } } }