Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
view: stop crashing when license field is an object (#20538)
Browse files Browse the repository at this point in the history
PR-URL: #20538
Credit: @zkat
Reviewed-By: @joeledwards
  • Loading branch information
zkat authored May 11, 2018
1 parent 483e011 commit a41c039
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ function prettyView (packument, manifest) {
})
const unpackedSize = manifest.dist.unpackedSize &&
byteSize(manifest.dist.unpackedSize)
const licenseField = manifest.license || manifest.licence || 'Proprietary'
const info = {
name: color.green(manifest.name),
version: color.green(manifest.version),
Expand All @@ -208,7 +209,9 @@ function prettyView (packument, manifest) {
description: manifest.description,
deprecated: manifest.deprecated,
keywords: (packument.keywords || []).map(color.yellow),
license: manifest.license || manifest.licence || 'Proprietary',
license: typeof licenseField === 'string'
? licenseField
: (licenseField.type || 'Proprietary'),
deps: Object.keys(manifest.dependencies || {}).map((dep) => {
return `${color.yellow(dep)}: ${manifest.dependencies[dep]}`
}),
Expand Down

0 comments on commit a41c039

Please sign in to comment.