shields-badge-data
TypeScript icon, indicating that this package has built-in type declarations

4.0.1 • Public • Published

shields-badge-data

Badge: npm version badge for package 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'

Package Sidebar

Install

npm i shields-badge-data

Weekly Downloads

1

Version

4.0.1

License

ISC

Unpacked Size

48.1 kB

Total Files

75

Last publish

Collaborators

  • mightyiam