Skip to content

Commit eb76a3b

Browse files
madmasAlexander Vakrilov
authored andcommitted
fix bug in case statement, allow jpg and jpeg (NativeScript#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.
1 parent b878143 commit eb76a3b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tns-core-modules/image-source/image-source.ios.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,11 @@ function getFileName(path: string): string {
185185
function getImageData(instance: UIImage, format: "png" | "jpeg" | "jpg", quality = 1.0): NSData {
186186
var data = null;
187187
switch (format) {
188-
case "png": // PNG
188+
case "png":
189189
data = UIImagePNGRepresentation(instance);
190190
break;
191-
case "jpeg" || "jpg": // JPEG
191+
case "jpeg":
192+
case "jpg":
192193
data = UIImageJPEGRepresentation(instance, quality);
193194
break;
194195
}

0 commit comments

Comments
 (0)