diff options
Diffstat (limited to 'lang/js/src/Message.js')
-rw-r--r-- | lang/js/src/Message.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lang/js/src/Message.js b/lang/js/src/Message.js index c42480f2..6a59c3e0 100644 --- a/lang/js/src/Message.js +++ b/lang/js/src/Message.js @@ -84,9 +84,22 @@ export class GPGME_Message { let checktype = function(val){ switch(typeof(val)){ case 'string': + if (poparam.allowed.indexOf(typeof(val)) >= 0 + && val.length > 0) { + return true; + } + return gpgme_error('PARAM_WRONG'); + break; case 'number': + if ( + poparam.allowed.indexOf('number') >= 0 + && isNaN(value) === false){ + return true; + } + return gpgme_error('PARAM_WRONG'); + break; case 'boolean': - if (poparam.allowed.indexOf(typeof(val)) >= 0){ + if (poparam.allowed.indexOf('boolean') >= 0){ return true; } return gpgme_error('PARAM_WRONG'); @@ -102,7 +115,9 @@ export class GPGME_Message { return res; } } - return true; + if (val.length > 0) { + return true; + } } else if (val instanceof Uint8Array){ if (poparam.allowed.indexOf('Uint8Array') >= 0){ return true; |