diff --git a/.eslintrc.json b/.eslintrc.json index 8f4927b..b9b2f91 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -23,6 +23,7 @@ "no-return-await": "off", "no-nested-ternary": "off", "import/no-extraneous-dependencies": "off", - "import/prefer-default-export": "off" + "import/prefer-default-export": "off", + "sonarjs/cognitive-complexity": "off" } } diff --git a/package.json b/package.json index 0ad7477..69bc2ec 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@docknetwork/prettyvc", "description": "Render pretty verifiable credentials", - "version": "1.1.2", + "version": "1.1.4", "main": "lib/index.js", "license": "MIT", "repository": { diff --git a/src/index.js b/src/index.js index e581784..a890314 100644 --- a/src/index.js +++ b/src/index.js @@ -156,11 +156,13 @@ function getSubjectDocuments({ credentialSubject }) { const subjects = Array.isArray(credentialSubject) ? credentialSubject : [credentialSubject]; return subjects.map((s) => { const docs = []; - Object.keys(s).forEach((k) => { - if (typeof s[k] === 'object') { - docs.push(s[k]); - } - }); + if (s && typeof s === 'object') { + Object.keys(s).forEach((k) => { + if (typeof s[k] === 'object') { + docs.push(s[k]); + } + }); + } return docs; }); } diff --git a/src/templates/credential.js b/src/templates/credential.js index 0edff4f..f394fed 100644 --- a/src/templates/credential.js +++ b/src/templates/credential.js @@ -5,8 +5,8 @@ export default function TemplateCredential({ }) { const attributesTableRows = attributes.map((attribute) => (`
Attribute | @@ -41,18 +38,23 @@ export default function TemplateCredential({ ` : ''} diff --git a/src/templates/diploma.js b/src/templates/diploma.js index dbc68e9..4543cce 100644 --- a/src/templates/diploma.js +++ b/src/templates/diploma.js @@ -29,32 +29,28 @@ export default function TemplateDiploma({ ${sanitize(issuerName)}
---|