4.0.1 • Published 5 years ago

shields-badge-data v4.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

shields-badge-data

Badge: npm version badge for package `shields-badge-data` Build Status Greenkeeper badge

Gets Shields.io badge data.

API

shieldsBadgeData(badgeName, badgeArgs, options?) => BadgeData

  • badgeName is one of these. For example, 'travisCi'.
  • badgeArgs: A set of arguments for the specific badge. See badge specs.
  • options?
    • rootImageUrl?: a root URL, for the case where you’re using your own badges server.
    • format?: 'svg', 'png', 'json', etc.
    • urlParams?
  • BadgeData:
    • title: Badge title. Useful for the alt attribute of an img element, for example.
    • image: A URL for the shields.io badge image.
    • link: A service specific URL.

URLs

URLs are WHATWG URL objects. The package.json browser field is used so that:

Example

import shieldsBadgeData from 'shields-badge-data'

const { title, image, link } = shieldsBadgeData('travisCi', { userRepo: 'foo/bar' })

title
// 'Travis CI build status badge for `foo/bar`'
image.href
// 'https://img.shields.io/travis/foo/bar.svg'
link.href
// 'https://travis-ci.org/foo/bar'
4.0.1

5 years ago

4.0.0

5 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago