Module: services/licenses

Common functions and utilities for tasks related to license badges.

Source:

Members

(inner, constant) licenseToColorMap :object

Mapping of licenses to their corresponding color and priority.

Type:
  • object
Source:

Methods

(inner) licenseToColor(licenses) → {string}

Maps the license to its corresponding color and priority and sorts the list of mapped licenses by priority.

Parameters:
Name Type Description
licenses string | Array.<string>

License or list of licenses

Source:
Returns:

Color corresponding to the license or the list of licenses

Type
string

(inner) renderLicenseBadge(attrs) → {object}

Handles rendering concerns of license badges. Determines the message of the badge by joining the licenses in a comma-separated format. Sets the badge color to the provided value, if not provided then the color is used from licenseToColorMap.

Parameters:
Name Type Description
attrs object

Refer to individual attributes

Properties
Name Type Attributes Description
license string <optional>

License to render, required if badge contains only one license

licenses Array.<string> <optional>

List of licenses to render, required if badge contains multiple licenses

color string <optional>

If provided then the badge will use this color value

Source:
Returns:

Badge with message and color properties

Type
object