Adding formatter for license types (#400)

This commit is contained in:
Alex Wicks
2021-06-24 18:04:06 +01:00
committed by GitHub
parent d59cec9861
commit 749dc98151
2 changed files with 8 additions and 1 deletions

View File

@@ -102,6 +102,13 @@ export function formatters({timeZone} = {}) {
return new Intl.DateTimeFormat("en-GB", {timeZone, ...options}).format(new Date(string))
}
/**License formatter */
format.license = function(license) {
if (license.spdxId === "NOASSERTION")
return license.name
return license.nickname ?? license.spdxId ?? license.name
}
return {format}
}