Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align label and message props of coalesceBadge() with internal makeBadge() #5719

Merged
merged 2 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions badge-maker/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ function _clean(format) {
}
})

// Legacy.
cleaned.label = cleaned.label || ''

// convert "public" format to "internal" format
cleaned.text = [cleaned.label || '', cleaned.message]
delete cleaned.label
delete cleaned.message
if ('style' in cleaned) {
cleaned.template = cleaned.style
delete cleaned.style
Expand Down
8 changes: 4 additions & 4 deletions badge-maker/lib/make-badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ it is likely this will impact on the package's public interface in index.js
module.exports = function makeBadge({
format,
template = 'flat',
text,
label,
message,
color,
labelColor,
logo,
Expand All @@ -19,9 +20,8 @@ module.exports = function makeBadge({
links = ['', ''],
}) {
// String coercion and whitespace removal.
text = text.map(value => `${value}`.trim())

const [label, message] = text
label = `${label}`.trim()
message = `${message}`.trim()

// This ought to be the responsibility of the server, not `makeBadge`.
if (format === 'json') {
Expand Down
Loading