diff --git a/lib/index.js b/lib/index.js index f125adf3..f069ca8d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -654,10 +654,13 @@ export function _checkCredential({ } if('credentialStatus' in credential) { - if(Array.isArray(credential.credentialStatus) ? credential.credentialStatus.some(cs => !cs.id) : !credential.credentialStatus.id) { + const {credentialStatus} = credential; + if(Array.isArray(credentialStatus) ? + credentialStatus.some(cs => !cs.id) : !credentialStatus.id) { throw new Error('"credentialStatus" must include an id.'); } - if(Array.isArray(credential.credentialStatus) ? credential.credentialStatus.some(cs => !cs.type) : !credential.credentialStatus.type) { + if(Array.isArray(credentialStatus) ? + credentialStatus.some(cs => !cs.type) : !credentialStatus.type) { throw new Error('"credentialStatus" must include a type.'); } }