Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function decompressImage(image) {
if (!!image.data) {
return Promise.resolve(image)
}
const byteArray = new Uint8Array(image.compressedData.buffer)
const reducer = (accumulator, currentValue) => accumulator * currentValue
const pixelCount = image.size.reduce(reducer, 1)
let componentSize = null
switch (image.imageType.componentType) {
case IntTypes.Int8:
componentSize = 1
break
case IntTypes.UInt8:
componentSize = 1
break
case IntTypes.Int16:
componentSize = 2
break
case IntTypes.UInt16:
componentSize = 2
break
case IntTypes.Int32:
componentSize = 4
break
case IntTypes.UInt32:
componentSize = 4