From 2bc95161ac980d7ffc74deddc646de9fc6ec5d23 Mon Sep 17 00:00:00 2001 From: Robert Abeyta Date: Mon, 18 May 2015 13:27:26 -0700 Subject: [PATCH] added validation method for outputType. If there is an invalid value entered, log to the console and default to FILE_URI --- www/imagepicker.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/www/imagepicker.js b/www/imagepicker.js index 7d01944..4a0e684 100644 --- a/www/imagepicker.js +++ b/www/imagepicker.js @@ -13,6 +13,17 @@ ImagePicker.prototype.OutputType = { FILE_URI: 0, BASE64_STRING: 1 }; + +ImagePicker.prototype.validateOutputType = function(options){ + var outputType = options.outputType; + if(outputType){ + if(outputType !== this.OutputType.FILE_URI && outputType !== this.OutputType.BASE64_STRING){ + console.log('Invalid output type option entered. Defaulting to FILE_URI. Please use window.imagePicker.OutputType.FILE_URI or window.imagePicker.OutputType.BASE64_STRING'); + options.outputType = this.OutputType.FILE_URI; + } + } +}; + /* * success - success callback * fail - error callback