mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
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:
committed by
Alexander Vakrilov
parent
b878143b63
commit
eb76a3b859
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user