Skip to content

Commit

Permalink
fix: don't mutate shield options
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed May 16, 2016
1 parent 0e5c1bb commit a6567cc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ function shieldman (service, opts) {
return undefined
}

if (!shieldTemplate.hasBranchVersion) {
delete opts.branch
}
const branch = shieldTemplate.hasBranchVersion ? opts.branch : null

const linkTemplate = opts.branch && shieldTemplate.branchLink || shieldTemplate.link
const linkTemplate = branch && shieldTemplate.branchLink || shieldTemplate.link

return {
text: shieldTemplate.text,
Expand All @@ -31,7 +29,7 @@ function shieldman (service, opts) {
}

function getShieldImage (imagePath) {
const branchSuffix = opts.branch && ('/' + opts.branch) || ''
const branchSuffix = branch && ('/' + branch) || ''
return `https://img.shields.io/${format(imagePath, opts)}` +
`${branchSuffix}.${ext}${opts.style ? `?style=${opts.style}` : ''}`
}
Expand Down

0 comments on commit a6567cc

Please sign in to comment.