Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function scan (imageData, locateOnly) {
let location = null
let content = null
const binaryImage = jsQR.binarizeImage(
imageData.data,
imageData.width,
imageData.height
)
location = jsQR.locateQRInBinaryImage(binaryImage)
if (location !== null && !locateOnly) {
const qrcode = jsQR.extractQRFromBinaryImage(binaryImage, location)
content = jsQR.decodeQR(qrcode)
}
return { location, content }
}