js: allow optional Key retrieve pattern to be null

--

* src/Keyring.js: If the optional "pattern" parameter is not to be
  used, but another, following parameter is, null is more of a
  convention in javascript, thus both null and undefined are
  interpreted as "this parameter is not meant to be set".
This commit is contained in:
Maximilian Krambach 2018-07-12 11:48:17 +02:00
parent 30bb549046
commit 5213a599fe

View File

@ -53,7 +53,7 @@ export class GPGME_Keyring {
getKeys(pattern, prepare_sync=false, search=false){ getKeys(pattern, prepare_sync=false, search=false){
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
let msg = createMessage('keylist'); let msg = createMessage('keylist');
if (pattern !== undefined){ if (pattern !== undefined && pattern !== null){
msg.setParameter('keys', pattern); msg.setParameter('keys', pattern);
} }
msg.setParameter('sigs', true); msg.setParameter('sigs', true);
@ -136,7 +136,7 @@ export class GPGME_Keyring {
if (with_secret_fpr === true) { if (with_secret_fpr === true) {
msg.setParameter('with-sec-fprs', true); msg.setParameter('with-sec-fprs', true);
} }
if (pattern !== undefined){ if (pattern !== undefined && pattern !== null){
msg.setParameter('keys', pattern); msg.setParameter('keys', pattern);
} }
msg.post().then(function(answer){ msg.post().then(function(answer){