Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
super(props);
const barcodeScannerType = props.barcodeScannerType
? props.barcodeScannerType
: 'qrCode';
this.state = {
barcodeScannerType: barcodeScannerType,
};
if (barcodeScannerType == 'qrCode') {
this.reader = new BrowserQRCodeReader();
} else if (barcodeScannerType == 'barcode') {
this.reader = new BrowserBarcodeReader();
} else if (barcodeScannerType == 'datamatrix') {
this.reader = new BrowserDatamatrixCodeReader();
} else {
throw new Error('Unknown barcodeScannerType: ' + barcodeScannerType);
}
}