added validation method for outputType. If there is an invalid value entered, log to the console and default to FILE_URI

This commit is contained in:
Robert Abeyta
2015-05-18 13:27:26 -07:00
parent ebb74d729c
commit 2bc95161ac
+11
View File
@@ -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