Skip to content

Commit

Permalink
Beautify author displayName
Browse files Browse the repository at this point in the history
  • Loading branch information
dmstern committed Jul 26, 2018
1 parent 927e237 commit 745c2fe
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/components/Modules.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h2>Packages</h2>
<ul>
<li v-for="(metaData, packageName) in packages" :key='packageName'>
{{ packageName }} (by {{metaData.author}})
{{ packageName }} (by {{metaData.displayName}})
</li>
</ul>
</div>
Expand Down Expand Up @@ -33,13 +33,23 @@ export default class Modules extends Vue {
const packageNames: any[] = Object.keys(packagesResponse).filter((key) => !key.startsWith('_'));
this.packages = {};
const authorKey: any = 'author';
const nameKey: any = 'name';
const displayNameKey: any = 'displayName';
for (const packageName of packageNames) {
console.log(packageName, packagesResponse[packageName]);
const displayName =
(
packagesResponse[packageName][authorKey]
&& packagesResponse[packageName][authorKey][nameKey]
)
? packagesResponse[packageName][authorKey][nameKey]
: packagesResponse[packageName][authorKey];
Object.assign(packagesResponse[packageName], {
displayName: displayName,
});
this.packages[packageName] = packagesResponse[packageName];
}
});
}
}
</script>

0 comments on commit 745c2fe

Please sign in to comment.