fix bug in case statement, allow jpg and jpeg (#5473)

the current implementation does not work if one specifies "jpg", it works only with "jpeg" due to the || syntax used. 
This is a proposal to fix it.
This commit is contained in:
Markus Schlichting
2018-03-01 08:11:59 +01:00
committed by Alexander Vakrilov
parent b878143b63
commit eb76a3b859

View File

@@ -185,10 +185,11 @@ function getFileName(path: string): string {
function getImageData(instance: UIImage, format: "png" | "jpeg" | "jpg", quality = 1.0): NSData {
var data = null;
switch (format) {
case "png": // PNG
case "png":
data = UIImagePNGRepresentation(instance);
break;
case "jpeg" || "jpg": // JPEG
case "jpeg":
case "jpg":
data = UIImageJPEGRepresentation(instance, quality);
break;
}