Skip to content

Commit

Permalink
Merge pull request #25 from docknetwork/fix/name-as-object
Browse files Browse the repository at this point in the history
Fix name displayed as [object Object] depending on data
  • Loading branch information
Shahzad-Dock authored Jan 10, 2023
2 parents 93dcf1c + bfebb22 commit 1e1979f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@docknetwork/prettyvc",
"description": "Render pretty verifiable credentials",
"version": "1.3.12",
"version": "1.3.13",
"main": "lib/index.js",
"license": "MIT",
"repository": {
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ function extractNameFields(s) {

function getSubjectName({ credentialSubject }, didMap) {
const subjects = Array.isArray(credentialSubject) ? credentialSubject : [credentialSubject];
return subjects.map((s) => s && mapDIDIfKnown(getObjectName(s, extractNameFields)), didMap).join(' & ');
return subjects.map((s) => s && mapDIDIfKnown(getObjectName(s, extractNameFields)), didMap)
.filter((s) => typeof s === 'string')
.join(' & ');
}

function getSubjectDocuments({ credentialSubject }) {
Expand Down
6 changes: 5 additions & 1 deletion src/templates/credential.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export default function TemplateCredential({
<h3 class="prettyVC-diploma-subtitle">
${sanitize(subjectName)}
</h3>
` : ''}
` : `
<p class="prettyVC-diploma-subtext">
has issued a <strong>${sanitize(title)}</strong>
</p>
`}
${attributes.length ? `
<br />
Expand Down

0 comments on commit 1e1979f

Please sign in to comment.