mirror of
https://github.com/badges/shields.git
synced 2025-04-18 19:44:04 +03:00
rename postfix param to suffix (#10667)
This commit is contained in:
parent
04638ab0ee
commit
2bd926e65f
@ -235,7 +235,7 @@ function rangeStart(v) {
|
||||
* @param {string} [options.tag] - The tag to display on the badge, such as "alpha" or "beta"
|
||||
* @param {string} [options.defaultLabel] - The default label to display on the badge, such as "npm" or "github"
|
||||
* @param {string} [options.prefix] - The prefix to display on the message, such as ">=", "v", overrides the default behavior of using addv
|
||||
* @param {string} [options.postfix] - The postfix to display on the message, such as "tested"
|
||||
* @param {string} [options.suffix] - The suffix to display on the message, such as "tested"
|
||||
* @param {Function} [options.versionFormatter=versionColor] - The function to use to format the color of the badge based on the version number
|
||||
* @param {boolean} [options.isPrerelease] - Whether the version is explicitly marked as a prerelease by upstream API
|
||||
* @returns {object} A badge object that has three properties: label, message, and color
|
||||
@ -249,7 +249,7 @@ function renderVersionBadge({
|
||||
tag,
|
||||
defaultLabel,
|
||||
prefix,
|
||||
postfix,
|
||||
suffix,
|
||||
versionFormatter = versionColor,
|
||||
isPrerelease,
|
||||
}) {
|
||||
@ -257,7 +257,7 @@ function renderVersionBadge({
|
||||
label: tag ? `${defaultLabel}@${tag}` : defaultLabel,
|
||||
message:
|
||||
(prefix ? `${prefix}${version}` : addv(version)) +
|
||||
(postfix ? ` ${postfix}` : ''),
|
||||
(suffix ? ` ${suffix}` : ''),
|
||||
color: versionFormatter(isPrerelease ? 'pre' : version),
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ describe('Version helpers', function () {
|
||||
message: 'v1.2.3',
|
||||
color: 'blue',
|
||||
})
|
||||
given({ version: '1.2.3', postfix: 'tested' }).expect({
|
||||
given({ version: '1.2.3', suffix: 'tested' }).expect({
|
||||
label: undefined,
|
||||
message: 'v1.2.3 tested',
|
||||
color: 'blue',
|
||||
@ -164,7 +164,7 @@ describe('Version helpers', function () {
|
||||
version: '1.2.3',
|
||||
tag: 'beta',
|
||||
defaultLabel: 'github',
|
||||
postfix: 'tested',
|
||||
suffix: 'tested',
|
||||
}).expect({
|
||||
label: 'github@beta',
|
||||
message: 'v1.2.3 tested',
|
||||
@ -197,7 +197,7 @@ describe('Version helpers', function () {
|
||||
given({
|
||||
version: '1.2.3',
|
||||
prefix: '^',
|
||||
postfix: 'tested',
|
||||
suffix: 'tested',
|
||||
}).expect({
|
||||
label: undefined,
|
||||
message: '^1.2.3 tested',
|
||||
@ -208,7 +208,7 @@ describe('Version helpers', function () {
|
||||
tag: 'beta',
|
||||
defaultLabel: 'github',
|
||||
prefix: '^',
|
||||
postfix: 'tested',
|
||||
suffix: 'tested',
|
||||
}).expect({
|
||||
label: 'github@beta',
|
||||
message: '^1.2.3 tested',
|
||||
|
@ -94,7 +94,7 @@ class WordpressPluginTestedVersion extends BaseWordpress {
|
||||
const color = await versionColorForWordpressVersion(testedVersion)
|
||||
return renderVersionBadge({
|
||||
version: testedVersion,
|
||||
postfix: 'tested',
|
||||
suffix: 'tested',
|
||||
versionFormatter: () => color,
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user