shields-badges-urls
v1.0.0
Published
Get Shields.io badges URLs.
Downloads
3
Maintainers
Readme
shields-badges-urls
API
shieldsBadgesUrls(serviceName, serviceParams, options?) => URLs
serviceName
andserviceParams
options
?format
?:'svg'
,'png'
,'json'
, etc.urlParams
?
URLs
: has two properties,image
andlink
. Both are WHATWG URL objects. Thepackage.json
browser
field is used so that in Node.js the URLs are instances ofURL
and in a browser build they are instances ofURL
.image
: The URL for the shields.io badge imagelink
: This is service specific. See the example, below.
Example
import shieldsBadgesUrls from 'shields-badges-urls'
const { image, link } = shieldsBadgesUrls('travis', { userRepo: 'foo/bar' })
image.href
// 'https://img.shields.io/travis/foo/bar.svg'
link.href
// 'https://travis-ci.org/foo/bar'