New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

badges

Package Overview
Dependencies
Maintainers
2
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

badges - npm Package Compare versions

Comparing version 4.23.0 to 4.24.0-next.1606109393.2103272a423a672a339752671141163950f496c9

edition-es2017-esm/badges.js

529

compiled-types/badges.d.ts
interface twitterOptions {
/** The twitter username to tweet at */
twitterUsername: string
/** The twitter username to tweet at */
twitterUsername: string;
}
interface homepageOptions {
/** The page url that the badge will be for */
homepage: string
/** The page url that the badge will be for */
homepage: string;
}
interface githubUsernameOptions {
/** The github username to use */
githubUsername: string
/** The github username to use */
githubUsername: string;
}
interface githubSlugOptions {
/** The github slug of the project (e.g. bevry/badges) */
githubSlug: string
/** The github slug of the project (e.g. bevry/badges) */
githubSlug: string;
}
interface npmOptions {
/** The npm package name */
npmPackageName: string
/** The npm package name */
npmPackageName: string;
}
interface badgeOptions {
/** The URL to the image **/
image?: string
/** The alt attribute for the image */
alt?: string
/** The URL for the link */
url?: string
/** The title attribute for the link */
title?: string
/** The URL to the image **/
image?: string;
/** The alt attribute for the image */
alt?: string;
/** The URL for the link */
url?: string;
/** The title attribute for the link */
title?: string;
}
/** Generate a HTML badge */
export declare function badge({ image, alt, url, title }: badgeOptions): string
export declare function badge({ image, alt, url, title }: badgeOptions): string;
export declare namespace badge {
var badgeCategory: string
var badgeCategory: string;
}
interface shieldsOptions {
/** The text for the left side of the badge */
left: string
/** The text for the right side of the badge */
right: string
/** The color for the badge */
color?: string
/** The alt attribute for the image */
alt?: string
/** The URL for the link */
url?: string
/** The title attribute for the link */
title?: string
/** The text for the left side of the badge */
left: string;
/** The text for the right side of the badge */
right: string;
/** The color for the badge */
color?: string;
/** The alt attribute for the image */
alt?: string;
/** The URL for the link */
url?: string;
/** The title attribute for the link */
title?: string;
}
/** Shields Custom Badge */
export declare function shields({
left,
right,
color,
alt,
url,
title,
}: shieldsOptions): string
export declare function shields({ left, right, color, alt, url, title, }: shieldsOptions): string;
export declare namespace shields {
var badgeCategory: string
var badgeCategory: string;
}
interface npmversionOptions {
/** The repository slug (username/reponame) */
npmPackageName: string
/** The repository slug (username/reponame) */
npmPackageName: string;
}
/** NPM Version Badge */
export declare function npmversion({
npmPackageName,
}: npmversionOptions): string
export declare function npmversion({ npmPackageName }: npmversionOptions): string;
export declare namespace npmversion {
var badgeCategory: string
var badgeCategory: string;
}
/** NPM Downloads Badge */
export declare function npmdownloads({ npmPackageName }: npmOptions): string
export declare function npmdownloads({ npmPackageName }: npmOptions): string;
export declare namespace npmdownloads {
var badgeCategory: string
var badgeCategory: string;
}
/** David DM Dependencies Badge */
export declare function daviddm({ githubSlug }: githubSlugOptions): string
export declare function daviddm({ githubSlug }: githubSlugOptions): string;
export declare namespace daviddm {
var badgeCategory: string
var badgeCategory: string;
}
/** David DM Dev Dependencies Badge */
export declare function daviddmdev({ githubSlug }: githubSlugOptions): string
export declare function daviddmdev({ githubSlug }: githubSlugOptions): string;
export declare namespace daviddmdev {
var badgeCategory: string
var badgeCategory: string;
}
interface nodeicoOptions extends npmOptions {
/** See https://nodei.co for options
/** See https://nodei.co for options
defined as either a string param1=&param2=
or an object {param1: '', param2: ''} that will be serialized to param1=&param2= etc. */
nodeicoQueryString?:
| string
| {
[index: string]: any
}
nodeicoQueryString?: string | {
[index: string]: any;
};
}
/** Nodei.co Badge */
export declare function nodeico({
npmPackageName,
nodeicoQueryString,
}: nodeicoOptions): string
export declare function nodeico({ npmPackageName, nodeicoQueryString, }: nodeicoOptions): string;
export declare namespace nodeico {
var badgeCategory: string
var badgeCategory: string;
}
interface saucelabsOptions {
/** The username of the sauncelabs account to use */
saucelabsUsername: string
/** Falls back to the `SAUCELABS_AUTH_TOKEN` environment variable if it is set */
saucelabsAuthToken?: string
/** The username of the sauncelabs account to use */
saucelabsUsername: string;
/** Falls back to the `SAUCELABS_AUTH_TOKEN` environment variable if it is set */
saucelabsAuthToken?: string;
}
/** Sauce Labs Browser Matrix Badge */
export declare function saucelabsbm({
saucelabsUsername,
saucelabsAuthToken,
}: saucelabsOptions): string
export declare function saucelabsbm({ saucelabsUsername, saucelabsAuthToken, }: saucelabsOptions): string;
export declare namespace saucelabsbm {
var badgeCategory: string
var badgeInline: boolean
var badgeCategory: string;
var badgeInline: boolean;
}
/** Sauce Labs Badge */
export declare function saucelabs({
saucelabsUsername,
saucelabsAuthToken,
}: saucelabsOptions): string
export declare function saucelabs({ saucelabsUsername, saucelabsAuthToken, }: saucelabsOptions): string;
export declare namespace saucelabs {
var badgeCategory: string
var badgeCategory: string;
}
interface travisOptions extends githubSlugOptions {
/** The TLD to use for travis, use "com" if you have moved to travis-ci.com instead of travis-ci.org */
travisTLD?: string
/** The TLD to use for travis, use "com" if you have moved to travis-ci.com instead of travis-ci.org */
travisTLD?: string;
}
/** Travis CI Badge */
export declare function travisci({
githubSlug,
travisTLD,
}: travisOptions): string
export declare function travisci({ githubSlug, travisTLD, }: travisOptions): string;
export declare namespace travisci {
var badgeCategory: string
var badgeCategory: string;
}
interface codeshipOptions {
/** The UUID for a specific project, which is available on the General tab in your project settings */
codeshipProjectUUID: string
/** The ID for a specific project, which is available via the URL for the codeship project page */
codeshipProjectID: string
/** The UUID for a specific project, which is available on the General tab in your project settings */
codeshipProjectUUID: string;
/** The ID for a specific project, which is available via the URL for the codeship project page */
codeshipProjectID: string;
}
/** Codeship Badge */
export declare function codeship({
codeshipProjectUUID,
codeshipProjectID,
}: codeshipOptions): string
export declare function codeship({ codeshipProjectUUID, codeshipProjectID, }: codeshipOptions): string;
export declare namespace codeship {
var badgeCategory: string
var badgeCategory: string;
}
/** Coveralls Badge */
export declare function coveralls({ githubSlug }: githubSlugOptions): string
export declare function coveralls({ githubSlug }: githubSlugOptions): string;
export declare namespace coveralls {
var badgeCategory: string
var badgeCategory: string;
}
/** Code Climate Rating Badge */
export declare function codeclimate({ githubSlug }: githubSlugOptions): string
export declare function codeclimate({ githubSlug }: githubSlugOptions): string;
export declare namespace codeclimate {
var badgeCategory: string
var badgeCategory: string;
}
/** BitHound Score Badge */
export declare function bithound({ githubSlug }: githubSlugOptions): string
export declare function bithound({ githubSlug }: githubSlugOptions): string;
export declare namespace bithound {
var badgeCategory: string
var badgeCategory: string;
}
/** Waffle Badge */
export declare function waffle({ githubSlug }: githubSlugOptions): string
export declare function waffle({ githubSlug }: githubSlugOptions): string;
export declare namespace waffle {
var badgeCategory: string
var badgeCategory: string;
}
interface githubworkflowOptions extends githubSlugOptions {
/** The name or location of the workflow file to show the badge for */
githubWorkflow: string;
/** The branch to constrain the badge to */
githubBranch?: string;
/** The event to constrain the badge to */
githubEvent?: string;
}
/** Github Workflow Badge */
export declare function githubworkflow({ githubWorkflow, githubBranch, githubEvent, githubSlug, }: githubworkflowOptions): string;
export declare namespace githubworkflow {
var badgeCategory: string;
}
/** At least one of the properties must be provided */
interface sixtydevOptions {
/** The 60devs username to donate to */
sixtydevstipsID?: string
/** The url to the 60devs donate page */
sixtydevstipsURL?: string
/** The 60devs username to donate to */
sixtydevstipsID?: string;
/** The url to the 60devs donate page */
sixtydevstipsURL?: string;
}
/** 60devs Tips Badge */
export declare function sixtydevstips({
sixtydevstipsID,
sixtydevstipsURL,
}: sixtydevOptions): string
export declare function sixtydevstips({ sixtydevstipsID, sixtydevstipsURL, }: sixtydevOptions): string;
export declare namespace sixtydevstips {
var badgeCategory: string
var badgeCategory: string;
}
/** At least one of the properties must be provided */
interface githubsponsorsOptions {
/** The url to the GitHub donate page */
githubSponsorsURL?: string
/** The GitHub username to donate to */
githubSponsorsUsername?: string
/** The GitHub username fallback to donate to */
githubUsername?: string
/** The url to the GitHub donate page */
githubSponsorsURL?: string;
/** The GitHub username to donate to */
githubSponsorsUsername?: string;
/** The GitHub username fallback to donate to */
githubUsername?: string;
}
/** Github Sponsors Badge */
export declare function githubsponsors({
githubSponsorsURL,
githubSponsorsUsername,
githubUsername,
}: githubsponsorsOptions): string
export declare function githubsponsors({ githubSponsorsURL, githubSponsorsUsername, githubUsername, }: githubsponsorsOptions): string;
export declare namespace githubsponsors {
var badgeCategory: string
var badgeCategory: string;
}
/** At least one of the properties must be provided */
interface patreonOptions {
/** The Patreon username to donate to */
patreonUsername?: string
/** The url to the Patreon donate page */
patreonURL?: string
/** The Patreon username to donate to */
patreonUsername?: string;
/** The url to the Patreon donate page */
patreonURL?: string;
}
/** Patreon Badge */
export declare function patreon({
patreonUsername,
patreonURL,
}: patreonOptions): string
export declare function patreon({ patreonUsername, patreonURL, }: patreonOptions): string;
export declare namespace patreon {
var badgeCategory: string
var badgeCategory: string;
}
/** At least one of the properties must be provided */
interface opencollectiveOptions {
/** The Open Collective username to donate to */
opencollectiveUsername?: string
/** The url to the Open Collective donate page */
opencollectiveURL?: string
/** The Open Collective username to donate to */
opencollectiveUsername?: string;
/** The url to the Open Collective donate page */
opencollectiveURL?: string;
}
/** Open Collective Badge */
export declare function opencollective({
opencollectiveUsername,
opencollectiveURL,
}: opencollectiveOptions): string
export declare function opencollective({ opencollectiveUsername, opencollectiveURL, }: opencollectiveOptions): string;
export declare namespace opencollective {
var badgeCategory: string
var badgeCategory: string;
}
/** At least one of the properties must be provided */
interface gratipayOptions {
/** The Gratipay username to donate to */
gratipayUsername?: string
/** The url to the Gratipay donate page */
gratipayURL?: string
/** The Gratipay username to donate to */
gratipayUsername?: string;
/** The url to the Gratipay donate page */
gratipayURL?: string;
}
/** Gratipay Badge */
export declare function gratipay({
gratipayUsername,
gratipayURL,
}: gratipayOptions): string
export declare function gratipay({ gratipayUsername, gratipayURL, }: gratipayOptions): string;
export declare namespace gratipay {
var badgeCategory: string
var badgeCategory: string;
}
/** At least one of the properties must be provided */
interface flattrOptions {
/** The Flattr code to donate to (e.g. 344188/balupton-on-Flattr) */
flattrCode?: string
/** The Flattr username to donate to (e.g. balupton) */
flattrUsername?: string
/** The url to the flattr donate page */
flattrURL?: string
/** The Flattr code to donate to (e.g. 344188/balupton-on-Flattr) */
flattrCode?: string;
/** The Flattr username to donate to (e.g. balupton) */
flattrUsername?: string;
/** The url to the flattr donate page */
flattrURL?: string;
}
/** Flattr Badge */
export declare function flattr({
flattrCode,
flattrUsername,
flattrURL,
}: flattrOptions): string
export declare function flattr({ flattrCode, flattrUsername, flattrURL, }: flattrOptions): string;
export declare namespace flattr {
var badgeCategory: string
var badgeCategory: string;
}
/** At least one of the properties must be provided */
interface paypalOptions {
/** The url to the paypal donate page */
paypalURL?: string
/** The Paypal button id */
paypalButtonID?: string
/** The Paypal.me username */
paypalUsername?: string
/** The url to the paypal donate page */
paypalURL?: string;
/** The Paypal button id */
paypalButtonID?: string;
/** The Paypal.me username */
paypalUsername?: string;
}
/** Paypal Badge */
export declare function paypal({
paypalURL,
paypalButtonID,
paypalUsername,
}: paypalOptions): string
export declare function paypal({ paypalURL, paypalButtonID, paypalUsername, }: paypalOptions): string;
export declare namespace paypal {
var badgeCategory: string
var badgeCategory: string;
}
interface cryptoOptions {
/** The url to the crypto donation page */
cryptoURL: string
/** @deprecated */
bitcoinURL?: string
/** The url to the crypto donation page */
cryptoURL: string;
/** @deprecated */
bitcoinURL?: string;
}
/** Crypto Badge */
export declare function crypto({ cryptoURL, bitcoinURL }: cryptoOptions): string
export declare function crypto({ cryptoURL, bitcoinURL }: cryptoOptions): string;
export declare namespace crypto {
var badgeCategory: string
var badgeCategory: string;
}
/** @deprecated */
export declare function bitcoin(opts: cryptoOptions): string
export declare function bitcoin(opts: cryptoOptions): string;
export declare namespace bitcoin {
var badgeCategory: string
var badgeCategory: string;
}
interface wishlistOptions {
/** The url to the wishlist page */
wishlistURL: string
/** The url to the wishlist page */
wishlistURL: string;
}
/** Wishlist Badge */
export declare function wishlist({ wishlistURL }: wishlistOptions): string
export declare function wishlist({ wishlistURL }: wishlistOptions): string;
export declare namespace wishlist {
var badgeCategory: string
var badgeCategory: string;
}
/** At least one of the properties must be provided */
interface buymeacoffeeOptions {
/** The Buy Me A Coffee username to donate to */
buymeacoffeeUsername?: string
/** The url to the Buy Me A Coffee donate page */
buymeacoffeeURL?: string
/** The Buy Me A Coffee username to donate to */
buymeacoffeeUsername?: string;
/** The url to the Buy Me A Coffee donate page */
buymeacoffeeURL?: string;
}
/** Buy Me A Coffee Badge */
export declare function buymeacoffee({
buymeacoffeeUsername,
buymeacoffeeURL,
}: buymeacoffeeOptions): string
export declare function buymeacoffee({ buymeacoffeeUsername, buymeacoffeeURL, }: buymeacoffeeOptions): string;
export declare namespace buymeacoffee {
var badgeCategory: string
var badgeCategory: string;
}
/** At least one of the properties must be provided */
interface liberapayOptions {
/** The Liberapay username to donate to */
liberapayUsername?: string
/** The url to the Liberapay donate page */
liberapayURL?: string
/** The Liberapay username to donate to */
liberapayUsername?: string;
/** The url to the Liberapay donate page */
liberapayURL?: string;
}
/** Liberapay Badge */
export declare function liberapay({
liberapayUsername,
liberapayURL,
}: liberapayOptions): string
export declare function liberapay({ liberapayUsername, liberapayURL, }: liberapayOptions): string;
export declare namespace liberapay {
var badgeCategory: string
var badgeCategory: string;
}
/** At least one of the properties must be provided */
interface thanksappOptions {
/** The repository slug (username/reponame) */
npmPackageName?: string
/** The github slug that the project lives at (e.g. bevry/badges) */
githubSlug?: string
/** The username for the Thanks App donate page */
thanksappUsername?: string
/** The url to the Thanks App donate page */
thanksappURL?: string
/** The repository slug (username/reponame) */
npmPackageName?: string;
/** The github slug that the project lives at (e.g. bevry/badges) */
githubSlug?: string;
/** The username for the Thanks App donate page */
thanksappUsername?: string;
/** The url to the Thanks App donate page */
thanksappURL?: string;
}
/** Thanks App Badge */
export declare function thanksapp({
npmPackageName,
githubSlug,
thanksappUsername,
thanksappURL,
}: thanksappOptions): string
export declare function thanksapp({ npmPackageName, githubSlug, thanksappUsername, thanksappURL, }: thanksappOptions): string;
export declare namespace thanksapp {
var badgeCategory: string
var badgeCategory: string;
}
/** Boost Lab Badge */
export declare function boostlab({ githubSlug }: githubSlugOptions): string
export declare function boostlab({ githubSlug }: githubSlugOptions): string;
export declare namespace boostlab {
var badgeCategory: string
var badgeCategory: string;
}
interface slackinOptions {
/** The slackin url (e.g. https://slack.bevry.me) */
slackinURL: string
/** The slackin url (e.g. https://slack.bevry.me) */
slackinURL: string;
}
/** Slackin Script Badge */
export declare function slackinscript({ slackinURL }: slackinOptions): string
export declare function slackinscript({ slackinURL }: slackinOptions): string;
export declare namespace slackinscript {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
/** Slackin Badge */
export declare function slackin({ slackinURL }: slackinOptions): string
export declare function slackin({ slackinURL }: slackinOptions): string;
export declare namespace slackin {
var badgeCategory: string
var badgeCategory: string;
}
interface gabeaconOptions {
/** The google analytics tracing id (e.g. UA-XXXXX-XX) */
gaTrackingID: string
/** The github slug that the project lives at (e.g. bevry/badges) */
githubSlug: string
/** The google analytics tracing id (e.g. UA-XXXXX-XX) */
gaTrackingID: string;
/** The github slug that the project lives at (e.g. bevry/badges) */
githubSlug: string;
}

@@ -395,104 +347,85 @@ /**

*/
export declare function gabeacon({
gaTrackingID,
githubSlug,
}: gabeaconOptions): string
export declare function gabeacon({ gaTrackingID, githubSlug, }: gabeaconOptions): string;
export declare namespace gabeacon {
var badgeCategory: string
var badgeCategory: string;
}
/** Google Plus One Button */
export declare function googleplusone({ homepage }: homepageOptions): string
export declare function googleplusone({ homepage }: homepageOptions): string;
export declare namespace googleplusone {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
/** Reddit Submit Button */
export declare function redditsubmit({ homepage }: homepageOptions): string
export declare function redditsubmit({ homepage }: homepageOptions): string;
export declare namespace redditsubmit {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
/** Hacker News Submit Button */
export declare function hackernewssubmit({ homepage }: homepageOptions): string
export declare function hackernewssubmit({ homepage }: homepageOptions): string;
export declare namespace hackernewssubmit {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
interface facebooklikeOptions extends homepageOptions {
/** The facebook application id that the badge is for, defaults to the environment variable `FACEBOOK_APPLICATION_ID` */
facebookApplicationID?: string
/** The facebook application id that the badge is for, defaults to the environment variable `FACEBOOK_APPLICATION_ID` */
facebookApplicationID?: string;
}
/** Facebook Like Button */
export declare function facebooklike({
homepage,
facebookApplicationID,
}: facebooklikeOptions): string
export declare function facebooklike({ homepage, facebookApplicationID, }: facebooklikeOptions): string;
export declare namespace facebooklike {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
interface facebookfollowOptions {
/** The facebook username to follow */
facebookUsername: string
/** The facebook application id that the badge is for, defaults to the environment variable `FACEBOOK_APPLICATION_ID` */
facebookApplicationID?: string
/** The facebook username to follow */
facebookUsername: string;
/** The facebook application id that the badge is for, defaults to the environment variable `FACEBOOK_APPLICATION_ID` */
facebookApplicationID?: string;
}
/** Facebook Follow Button */
export declare function facebookfollow({
facebookUsername,
facebookApplicationID,
}: facebookfollowOptions): string
export declare function facebookfollow({ facebookUsername, facebookApplicationID, }: facebookfollowOptions): string;
export declare namespace facebookfollow {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
/** Twitter Tweet Button */
export declare function twittertweet({
twitterUsername,
}: twitterOptions): string
export declare function twittertweet({ twitterUsername }: twitterOptions): string;
export declare namespace twittertweet {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
/** Twitter Follow Button */
export declare function twitterfollow({
twitterUsername,
}: twitterOptions): string
export declare function twitterfollow({ twitterUsername }: twitterOptions): string;
export declare namespace twitterfollow {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
/** Github Follow Button */
export declare function githubfollow({
githubUsername,
}: githubUsernameOptions): string
export declare function githubfollow({ githubUsername, }: githubUsernameOptions): string;
export declare namespace githubfollow {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
/** GitHub Star Button */
export declare function githubstar({ githubSlug }: githubSlugOptions): string
export declare function githubstar({ githubSlug }: githubSlugOptions): string;
export declare namespace githubstar {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
interface quoraOptions {
/** The quora user to follow */
quoraUsername: string
/** The quora user's name */
quoraRealname?: string
/** Some code */
quoraCode?: string
/** The quora user to follow */
quoraUsername: string;
/** The quora user's name */
quoraRealname?: string;
/** Some code */
quoraCode?: string;
}
/** Quora Follow Button */
export declare function quorafollow({
quoraUsername,
quoraRealname,
quoraCode,
}: quoraOptions): string
export declare function quorafollow({ quoraUsername, quoraRealname, quoraCode, }: quoraOptions): string;
export declare namespace quorafollow {
var badgeCategory: string
var badgeScript: boolean
var badgeCategory: string;
var badgeScript: boolean;
}
export {}
//# sourceMappingURL=badges.d.ts.map
export {};
//# sourceMappingURL=badges.d.ts.map

@@ -1,3 +0,3 @@

import * as badges from './badges.js'
export { badges }
import * as badges from './badges.js';
export { badges };
/**

@@ -10,18 +10,18 @@ * Render a specified badge with the appropriate wrapping (div if block badge, span if inline badge)

*/
export declare function renderBadge(badgeName: string, config?: {}): string
export declare function renderBadge(badgeName: string, config?: {}): string;
export interface RenderOptions {
filterCategory?: false | string
filterScripts?: boolean
filterCategory?: false | string;
filterScripts?: boolean;
}
export declare type BadgeEntry = string | [string, object]
export declare type BadgeEntries = BadgeEntry[]
export declare type BadgesList = BadgeEntries
export declare type BadgesOptions = RenderOptions
export declare type BadgeEntry = string | [string, object];
export declare type BadgeEntries = BadgeEntry[];
export declare type BadgesList = BadgeEntries;
export declare type BadgesOptions = RenderOptions;
export interface BadgesConfig {
[key: string]: any
[key: string]: any;
}
export interface BadgesField {
list: BadgeEntries
config?: BadgesConfig
options?: RenderOptions
list: BadgeEntries;
config?: BadgesConfig;
options?: RenderOptions;
}

@@ -35,7 +35,3 @@ /**

*/
export declare function renderBadges(
list: BadgesList,
config?: BadgesConfig,
options?: RenderOptions
): string
//# sourceMappingURL=index.d.ts.map
export declare function renderBadges(list: BadgesList, config?: BadgesConfig, options?: RenderOptions): string;
//# sourceMappingURL=index.d.ts.map
// Import
import { stringify } from 'querystring'
import { stringify } from 'querystring';
// @ts-ignore
const env = typeof process !== 'undefined' ? process.env : {}
const env = typeof process !== 'undefined' ? process.env : {};
/** Generate a HTML badge */
export function badge({ image, alt, url, title }) {
// Check
if (!image) throw new Error('image is missing')
// Create
let result = alt
? `<img src="${image}" alt="${alt}" />`
: `<img src="${image}" />`
if (url) {
result =
(title ? `<a href="${url}" title="${title}">` : `<a href="${url}">`) +
result +
'</a>'
}
return result
// Check
if (!image)
throw new Error('image is missing');
// Create
let result = alt
? `<img src="${image}" alt="${alt}" />`
: `<img src="${image}" />`;
if (url) {
result =
(title ? `<a href="${url}" title="${title}">` : `<a href="${url}">`) +
result +
'</a>';
}
return result;
}
badge.badgeCategory = 'custom'
badge.badgeCategory = 'custom';
/** Shields Custom Badge */
export function shields({ left, right, color = 'yellow', alt, url, title }) {
// Check
if (!left) throw new Error('left is missing')
if (!right) throw new Error('right is missing')
// Create
const image = `https://img.shields.io/badge/${left}-${right}-${color}.svg`
return badge({ image, alt, url, title })
export function shields({ left, right, color = 'yellow', alt, url, title, }) {
// Check
if (!left)
throw new Error('left is missing');
if (!right)
throw new Error('right is missing');
// Create
const image = `https://img.shields.io/badge/${left}-${right}-${color}.svg`;
return badge({ image, alt, url, title });
}
shields.badgeCategory = 'custom'
shields.badgeCategory = 'custom';
/** NPM Version Badge */
export function npmversion({ npmPackageName }) {
// Check
if (!npmPackageName) throw new Error('npmPackageName is missing')
// Create
const image = `https://img.shields.io/npm/v/${npmPackageName}.svg`
const url = `https://npmjs.org/package/${npmPackageName}`
const alt = 'NPM version'
const title = 'View this project on NPM'
return badge({ image, alt, url, title })
// Check
if (!npmPackageName)
throw new Error('npmPackageName is missing');
// Create
const image = `https://img.shields.io/npm/v/${npmPackageName}.svg`;
const url = `https://npmjs.org/package/${npmPackageName}`;
const alt = 'NPM version';
const title = 'View this project on NPM';
return badge({ image, alt, url, title });
}
npmversion.badgeCategory = 'development'
npmversion.badgeCategory = 'development';
/** NPM Downloads Badge */
export function npmdownloads({ npmPackageName }) {
// Check
if (!npmPackageName) throw new Error('npmPackageName is missing')
const image = `https://img.shields.io/npm/dm/${npmPackageName}.svg`
const url = `https://npmjs.org/package/${npmPackageName}`
const alt = 'NPM downloads'
const title = 'View this project on NPM'
return badge({ image, alt, url, title })
// Check
if (!npmPackageName)
throw new Error('npmPackageName is missing');
const image = `https://img.shields.io/npm/dm/${npmPackageName}.svg`;
const url = `https://npmjs.org/package/${npmPackageName}`;
const alt = 'NPM downloads';
const title = 'View this project on NPM';
return badge({ image, alt, url, title });
}
npmdownloads.badgeCategory = 'development'
npmdownloads.badgeCategory = 'development';
/** David DM Dependencies Badge */
export function daviddm({ githubSlug }) {
// Check
if (!githubSlug) throw new Error('githubSlug is missing')
// Create
const image = `https://img.shields.io/david/${githubSlug}.svg`
const url = `https://david-dm.org/${githubSlug}`
const alt = 'Dependency Status'
const title = "View the status of this project's dependencies on DavidDM"
return badge({ image, alt, url, title })
// Check
if (!githubSlug)
throw new Error('githubSlug is missing');
// Create
const image = `https://img.shields.io/david/${githubSlug}.svg`;
const url = `https://david-dm.org/${githubSlug}`;
const alt = 'Dependency Status';
const title = "View the status of this project's dependencies on DavidDM";
return badge({ image, alt, url, title });
}
daviddm.badgeCategory = 'development'
daviddm.badgeCategory = 'development';
/** David DM Dev Dependencies Badge */
export function daviddmdev({ githubSlug }) {
// Check
if (!githubSlug) throw new Error('githubSlug is missing')
// Create
const image = `https://img.shields.io/david/dev/${githubSlug}.svg`
const url = `https://david-dm.org/${githubSlug}#info=devDependencies`
const alt = 'Dev Dependency Status'
const title =
"View the status of this project's development dependencies on DavidDM"
return badge({ image, alt, url, title })
// Check
if (!githubSlug)
throw new Error('githubSlug is missing');
// Create
const image = `https://img.shields.io/david/dev/${githubSlug}.svg`;
const url = `https://david-dm.org/${githubSlug}#info=devDependencies`;
const alt = 'Dev Dependency Status';
const title = "View the status of this project's development dependencies on DavidDM";
return badge({ image, alt, url, title });
}
daviddmdev.badgeCategory = 'development'
daviddmdev.badgeCategory = 'development';
/** Nodei.co Badge */
export function nodeico({ npmPackageName, nodeicoQueryString }) {
// Prepare
if (!npmPackageName) throw new Error('npmPackageName is missing')
if (
nodeicoQueryString &&
typeof nodeicoQueryString !== 'string' &&
typeof nodeicoQueryString !== 'object'
) {
throw new Error('nodeicoQueryString must be a string or an object')
}
// Return
const url = `https://www.npmjs.com/package/${npmPackageName}`
const alt = 'Nodei.co badge'
const title = 'Nodei.co badge'
let image = `https://nodei.co/npm/${npmPackageName}.png`
const query =
typeof nodeicoQueryString === 'object'
? stringify(nodeicoQueryString)
: nodeicoQueryString
if (query) image += `?${query}`
return badge({ image, alt, url, title })
export function nodeico({ npmPackageName, nodeicoQueryString, }) {
// Prepare
if (!npmPackageName)
throw new Error('npmPackageName is missing');
if (nodeicoQueryString &&
typeof nodeicoQueryString !== 'string' &&
typeof nodeicoQueryString !== 'object') {
throw new Error('nodeicoQueryString must be a string or an object');
}
// Return
const url = `https://www.npmjs.com/package/${npmPackageName}`;
const alt = 'Nodei.co badge';
const title = 'Nodei.co badge';
let image = `https://nodei.co/npm/${npmPackageName}.png`;
const query = typeof nodeicoQueryString === 'object'
? stringify(nodeicoQueryString)
: nodeicoQueryString;
if (query)
image += `?${query}`;
return badge({ image, alt, url, title });
}
nodeico.badgeCategory = 'development'
nodeico.badgeCategory = 'development';
/** Sauce Labs Browser Matrix Badge */
export function saucelabsbm({ saucelabsUsername, saucelabsAuthToken }) {
// Check
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing')
saucelabsAuthToken = saucelabsAuthToken || env.SAUCELABS_AUTH_TOKEN
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing')
// Create
const image = `https://saucelabs.com/browser-matrix/${saucelabsUsername}.svg?auth=${escape(
saucelabsAuthToken
)}`
const url = `https://saucelabs.com/u/${saucelabsUsername}`
const alt = 'Sauce Labs Browser Matrix'
const title = "Check this project's browser tests on Sauce Labs"
return badge({ image, alt, url, title })
export function saucelabsbm({ saucelabsUsername, saucelabsAuthToken, }) {
// Check
if (!saucelabsUsername)
throw new Error('saucelabsUsername is missing');
saucelabsAuthToken = saucelabsAuthToken || env.SAUCELABS_AUTH_TOKEN;
if (!saucelabsAuthToken)
throw new Error('saucelabsAuthToken is missing');
// Create
const image = `https://saucelabs.com/browser-matrix/${saucelabsUsername}.svg?auth=${escape(saucelabsAuthToken)}`;
const url = `https://saucelabs.com/u/${saucelabsUsername}`;
const alt = 'Sauce Labs Browser Matrix';
const title = "Check this project's browser tests on Sauce Labs";
return badge({ image, alt, url, title });
}
saucelabsbm.badgeCategory = 'testing'
saucelabsbm.badgeInline = false
saucelabsbm.badgeCategory = 'testing';
saucelabsbm.badgeInline = false;
/** Sauce Labs Badge */
export function saucelabs({ saucelabsUsername, saucelabsAuthToken }) {
// Check
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing')
saucelabsAuthToken = saucelabsAuthToken || env.SAUCELABS_AUTH_TOKEN
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing')
// Create
const image = `https://saucelabs.com/browser-matrix/${saucelabsUsername}.svg?auth=${escape(
saucelabsAuthToken
)}`
const url = `https://saucelabs.com/u/${saucelabsUsername}`
const alt = 'Sauce Labs Browser Matrix'
const title = "Check this project's browser tests on Sauce Labs"
return badge({ image, alt, url, title })
export function saucelabs({ saucelabsUsername, saucelabsAuthToken, }) {
// Check
if (!saucelabsUsername)
throw new Error('saucelabsUsername is missing');
saucelabsAuthToken = saucelabsAuthToken || env.SAUCELABS_AUTH_TOKEN;
if (!saucelabsAuthToken)
throw new Error('saucelabsAuthToken is missing');
// Create
const image = `https://saucelabs.com/browser-matrix/${saucelabsUsername}.svg?auth=${escape(saucelabsAuthToken)}`;
const url = `https://saucelabs.com/u/${saucelabsUsername}`;
const alt = 'Sauce Labs Browser Matrix';
const title = "Check this project's browser tests on Sauce Labs";
return badge({ image, alt, url, title });
}
saucelabs.badgeCategory = 'testing'
saucelabs.badgeCategory = 'testing';
/** Travis CI Badge */
export function travisci({ githubSlug, travisTLD = 'org' }) {
// Check
if (!githubSlug) throw new Error('githubSlug is missing')
// Create
const image = [
'https://img.shields.io/travis',
travisTLD === 'com' ? 'com' : '',
githubSlug,
'master.svg',
]
.filter((i) => Boolean(i))
.join('/')
const url = `http://travis-ci.${travisTLD}/${githubSlug}`
const alt = 'Travis CI Build Status'
const title = "Check this project's build status on TravisCI"
return badge({ image, alt, url, title })
export function travisci({ githubSlug, travisTLD = 'org', }) {
// Check
if (!githubSlug)
throw new Error('githubSlug is missing');
// Create
const image = [
'https://img.shields.io/travis',
travisTLD === 'com' ? 'com' : '',
githubSlug,
'master.svg',
]
.filter((i) => Boolean(i))
.join('/');
const url = `http://travis-ci.${travisTLD}/${githubSlug}`;
const alt = 'Travis CI Build Status';
const title = "Check this project's build status on TravisCI";
return badge({ image, alt, url, title });
}
travisci.badgeCategory = 'testing'
travisci.badgeCategory = 'testing';
/** Codeship Badge */
export function codeship({ codeshipProjectUUID, codeshipProjectID }) {
// Check
if (!codeshipProjectUUID) throw new Error('codeshipProjectUUID is missing')
if (!codeshipProjectID) throw new Error('codeshipProjectID is missing')
// Create
const image = `https://img.shields.io/codeship/${codeshipProjectUUID}/master.svg`
const url = `https://www.codeship.io/projects/${codeshipProjectID}`
const alt = 'Codeship Status'
const title = "Check this project's status on Codeship"
return badge({ image, alt, url, title })
export function codeship({ codeshipProjectUUID, codeshipProjectID, }) {
// Check
if (!codeshipProjectUUID)
throw new Error('codeshipProjectUUID is missing');
if (!codeshipProjectID)
throw new Error('codeshipProjectID is missing');
// Create
const image = `https://img.shields.io/codeship/${codeshipProjectUUID}/master.svg`;
const url = `https://www.codeship.io/projects/${codeshipProjectID}`;
const alt = 'Codeship Status';
const title = "Check this project's status on Codeship";
return badge({ image, alt, url, title });
}
codeship.badgeCategory = 'testing'
codeship.badgeCategory = 'testing';
/** Coveralls Badge */
export function coveralls({ githubSlug }) {
// Check
if (!githubSlug) throw new Error('githubSlug is missing')
// Create
const image = `https://img.shields.io/coveralls/${githubSlug}.svg`
const url = `https://coveralls.io/r/${githubSlug}`
const alt = 'Coveralls Coverage Status'
const title = "View this project's coverage on Coveralls"
return badge({ image, alt, url, title })
// Check
if (!githubSlug)
throw new Error('githubSlug is missing');
// Create
const image = `https://img.shields.io/coveralls/${githubSlug}.svg`;
const url = `https://coveralls.io/r/${githubSlug}`;
const alt = 'Coveralls Coverage Status';
const title = "View this project's coverage on Coveralls";
return badge({ image, alt, url, title });
}
coveralls.badgeCategory = 'testing'
coveralls.badgeCategory = 'testing';
/** Code Climate Rating Badge */
export function codeclimate({ githubSlug }) {
// Check
if (!githubSlug) throw new Error('githubSlug is missing')
// Create
const image = `https://img.shields.io/codeclimate/github/${githubSlug}.svg`
const url = `https://codeclimate.com/github/${githubSlug}`
const alt = 'Code Climate Rating'
const title = "View this project's rating on Code Climate"
return badge({ image, alt, url, title })
// Check
if (!githubSlug)
throw new Error('githubSlug is missing');
// Create
const image = `https://img.shields.io/codeclimate/github/${githubSlug}.svg`;
const url = `https://codeclimate.com/github/${githubSlug}`;
const alt = 'Code Climate Rating';
const title = "View this project's rating on Code Climate";
return badge({ image, alt, url, title });
}
codeclimate.badgeCategory = 'testing'
codeclimate.badgeCategory = 'testing';
/** BitHound Score Badge */
export function bithound({ githubSlug }) {
// Check
if (!githubSlug) throw new Error('githubSlug is missing')
// Create
const image = `https://bithound.io/github/${githubSlug}/badges/score.svg`
const url = `https://bithound.io/github/${githubSlug}`
const alt = 'BitHound Score'
const title = "View this project's score on BitHound"
return badge({ image, alt, url, title })
// Check
if (!githubSlug)
throw new Error('githubSlug is missing');
// Create
const image = `https://bithound.io/github/${githubSlug}/badges/score.svg`;
const url = `https://bithound.io/github/${githubSlug}`;
const alt = 'BitHound Score';
const title = "View this project's score on BitHound";
return badge({ image, alt, url, title });
}
bithound.badgeCategory = 'testing'
bithound.badgeCategory = 'testing';
/** Waffle Badge */
export function waffle({ githubSlug }) {
// Check
if (!githubSlug) throw new Error('githubSlug is missing')
// Create
const label = 'ready'
const image = `https://badge.waffle.io/${githubSlug}.png?label=${escape(
label
)}`
const url = `http://waffle.io/${githubSlug}`
const alt = 'Stories in Ready'
const title = "View this project's stories on Waffle.io"
return badge({ image, alt, url, title })
// Check
if (!githubSlug)
throw new Error('githubSlug is missing');
// Create
const label = 'ready';
const image = `https://badge.waffle.io/${githubSlug}.png?label=${escape(label)}`;
const url = `http://waffle.io/${githubSlug}`;
const alt = 'Stories in Ready';
const title = "View this project's stories on Waffle.io";
return badge({ image, alt, url, title });
}
waffle.badgeCategory = 'testing'
waffle.badgeCategory = 'testing';
/** Github Workflow Badge */
export function githubworkflow({ githubWorkflow, githubBranch, githubEvent, githubSlug, }) {
// Check
if (!githubSlug)
throw new Error('githubSlug is missing');
if (!githubWorkflow)
throw new Error('githubWorkflow is missing');
// Create
// https://shields.io/category/build
// https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/adding-a-workflow-status-badge#using-a-workflow-name
const image = new URL(`https://github.com/${githubSlug}/workflows/${githubWorkflow}/badge.svg`);
if (githubBranch)
image.searchParams.set('branch', githubBranch);
if (githubEvent)
image.searchParams.set('event', githubEvent);
const link = new URL(`https://github.com/${githubSlug}/actions`);
link.searchParams.set('query', `workflow:${githubWorkflow}`);
const alt = `Status of the GitHub Workflow: ${githubWorkflow}`;
const title = `View the status of this project's GitHub Workflow: ${githubWorkflow}`;
return badge({ image: image.toString(), url: link.toString(), alt, title });
}
githubworkflow.badgeCategory = 'testing';
/** 60devs Tips Badge */
export function sixtydevstips({ sixtydevstipsID, sixtydevstipsURL }) {
// Check
if (!sixtydevstipsURL) {
if (!sixtydevstipsID) throw new Error('sixtydevstipsID is missing')
sixtydevstipsURL = `https://tips.60devs.com/tip/${sixtydevstipsID}`
}
// Create
const image = 'https://img.shields.io/badge/60devs-donate-yellow.svg'
const url = sixtydevstipsURL
const alt = '60devs tips donate button'
const title = 'Donate to this project using 60devs tips'
return badge({ image, alt, url, title })
export function sixtydevstips({ sixtydevstipsID, sixtydevstipsURL, }) {
// Check
if (!sixtydevstipsURL) {
if (!sixtydevstipsID)
throw new Error('sixtydevstipsID is missing');
sixtydevstipsURL = `https://tips.60devs.com/tip/${sixtydevstipsID}`;
}
// Create
const image = 'https://img.shields.io/badge/60devs-donate-yellow.svg';
const url = sixtydevstipsURL;
const alt = '60devs tips donate button';
const title = 'Donate to this project using 60devs tips';
return badge({ image, alt, url, title });
}
sixtydevstips.badgeCategory = 'funding'
sixtydevstips.badgeCategory = 'funding';
/** Github Sponsors Badge */
export function githubsponsors({
githubSponsorsURL,
githubSponsorsUsername,
githubUsername,
}) {
if (!githubSponsorsURL) {
if (!githubSponsorsUsername && !githubUsername)
throw new Error('githubSponsorsUsername and githubUsername are missing')
githubSponsorsURL = `https://github.com/sponsors/${
githubSponsorsUsername || githubUsername
}`
}
// Create
const image = 'https://img.shields.io/badge/github-donate-yellow.svg'
const url = githubSponsorsURL
const alt = 'GitHub Sponsors donate button'
const title = 'Donate to this project using GitHub Sponsors'
return badge({ image, alt, url, title })
export function githubsponsors({ githubSponsorsURL, githubSponsorsUsername, githubUsername, }) {
if (!githubSponsorsURL) {
if (!githubSponsorsUsername && !githubUsername)
throw new Error('githubSponsorsUsername and githubUsername are missing');
githubSponsorsURL = `https://github.com/sponsors/${githubSponsorsUsername || githubUsername}`;
}
// Create
const image = 'https://img.shields.io/badge/github-donate-yellow.svg';
const url = githubSponsorsURL;
const alt = 'GitHub Sponsors donate button';
const title = 'Donate to this project using GitHub Sponsors';
return badge({ image, alt, url, title });
}
githubsponsors.badgeCategory = 'funding'
githubsponsors.badgeCategory = 'funding';
/** Patreon Badge */
export function patreon({ patreonUsername, patreonURL }) {
// Check
if (!patreonURL) {
if (!patreonUsername) throw new Error('patreonUsername is missing')
patreonURL = `https://patreon.com/${patreonUsername}`
}
// Create
const image = 'https://img.shields.io/badge/patreon-donate-yellow.svg'
const url = patreonURL
const alt = 'Patreon donate button'
const title = 'Donate to this project using Patreon'
return badge({ image, alt, url, title })
export function patreon({ patreonUsername, patreonURL, }) {
// Check
if (!patreonURL) {
if (!patreonUsername)
throw new Error('patreonUsername is missing');
patreonURL = `https://patreon.com/${patreonUsername}`;
}
// Create
const image = 'https://img.shields.io/badge/patreon-donate-yellow.svg';
const url = patreonURL;
const alt = 'Patreon donate button';
const title = 'Donate to this project using Patreon';
return badge({ image, alt, url, title });
}
patreon.badgeCategory = 'funding'
patreon.badgeCategory = 'funding';
/** Open Collective Badge */
export function opencollective({ opencollectiveUsername, opencollectiveURL }) {
// Check
if (!opencollectiveURL) {
if (!opencollectiveUsername)
throw new Error('opencollectiveUsername is missing')
opencollectiveURL = `https://opencollective.com/${opencollectiveUsername}`
}
// Create
const image =
'https://img.shields.io/badge/open%20collective-donate-yellow.svg'
const url = opencollectiveURL
const alt = 'Open Collective donate button'
const title = 'Donate to this project using Open Collective'
return badge({ image, alt, url, title })
export function opencollective({ opencollectiveUsername, opencollectiveURL, }) {
// Check
if (!opencollectiveURL) {
if (!opencollectiveUsername)
throw new Error('opencollectiveUsername is missing');
opencollectiveURL = `https://opencollective.com/${opencollectiveUsername}`;
}
// Create
const image = 'https://img.shields.io/badge/open%20collective-donate-yellow.svg';
const url = opencollectiveURL;
const alt = 'Open Collective donate button';
const title = 'Donate to this project using Open Collective';
return badge({ image, alt, url, title });
}
opencollective.badgeCategory = 'funding'
opencollective.badgeCategory = 'funding';
/** Gratipay Badge */
export function gratipay({ gratipayUsername, gratipayURL }) {
// Check
if (!gratipayURL) {
if (!gratipayUsername) throw new Error('gratipayUsername is missing')
gratipayURL = `https://gratipay.com/${gratipayUsername}`
}
// Create
const image = 'https://img.shields.io/badge/gratipay-donate-yellow.svg'
const url = gratipayURL
const alt = 'Gratipay donate button'
const title = 'Donate weekly to this project using Gratipay'
return badge({ image, alt, url, title })
export function gratipay({ gratipayUsername, gratipayURL, }) {
// Check
if (!gratipayURL) {
if (!gratipayUsername)
throw new Error('gratipayUsername is missing');
gratipayURL = `https://gratipay.com/${gratipayUsername}`;
}
// Create
const image = 'https://img.shields.io/badge/gratipay-donate-yellow.svg';
const url = gratipayURL;
const alt = 'Gratipay donate button';
const title = 'Donate weekly to this project using Gratipay';
return badge({ image, alt, url, title });
}
gratipay.badgeCategory = 'funding'
gratipay.badgeCategory = 'funding';
/** Flattr Badge */
export function flattr({ flattrCode, flattrUsername, flattrURL }) {
// Check
if (!flattrURL) {
if (flattrUsername) {
flattrURL = `https://flattr.com/profile/${flattrUsername}`
} else if (flattrCode) {
flattrURL = `https://flattr.com/thing/${flattrCode}`
} else {
throw new Error('flattrUsername/flattrCode is missing')
}
}
// Create
const image = 'https://img.shields.io/badge/flattr-donate-yellow.svg'
const url = flattrURL
const alt = 'Flattr donate button'
const title = 'Donate to this project using Flattr'
return badge({ image, alt, url, title })
export function flattr({ flattrCode, flattrUsername, flattrURL, }) {
// Check
if (!flattrURL) {
if (flattrUsername) {
flattrURL = `https://flattr.com/profile/${flattrUsername}`;
}
else if (flattrCode) {
flattrURL = `https://flattr.com/thing/${flattrCode}`;
}
else {
throw new Error('flattrUsername/flattrCode is missing');
}
}
// Create
const image = 'https://img.shields.io/badge/flattr-donate-yellow.svg';
const url = flattrURL;
const alt = 'Flattr donate button';
const title = 'Donate to this project using Flattr';
return badge({ image, alt, url, title });
}
flattr.badgeCategory = 'funding'
flattr.badgeCategory = 'funding';
/** Paypal Badge */
export function paypal({ paypalURL, paypalButtonID, paypalUsername }) {
// Check
if (!paypalURL) {
if (paypalButtonID) {
paypalURL = `https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=${escape(
paypalButtonID
)}`
} else if (paypalUsername) {
paypalURL = `https://paypal.me/${paypalUsername}`
} else {
throw new Error(
'paypalURL, paypalButtonID, or paypalUsername is missing, at least one must exist'
)
}
}
// Create
const image = 'https://img.shields.io/badge/paypal-donate-yellow.svg'
const url = paypalURL
const alt = 'PayPal donate button'
const title = 'Donate to this project using Paypal'
return badge({ image, alt, url, title })
export function paypal({ paypalURL, paypalButtonID, paypalUsername, }) {
// Check
if (!paypalURL) {
if (paypalButtonID) {
paypalURL = `https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=${escape(paypalButtonID)}`;
}
else if (paypalUsername) {
paypalURL = `https://paypal.me/${paypalUsername}`;
}
else {
throw new Error('paypalURL, paypalButtonID, or paypalUsername is missing, at least one must exist');
}
}
// Create
const image = 'https://img.shields.io/badge/paypal-donate-yellow.svg';
const url = paypalURL;
const alt = 'PayPal donate button';
const title = 'Donate to this project using Paypal';
return badge({ image, alt, url, title });
}
paypal.badgeCategory = 'funding'
paypal.badgeCategory = 'funding';
/** Crypto Badge */
export function crypto({ cryptoURL, bitcoinURL }) {
// Check
const url = cryptoURL || bitcoinURL
if (!url) throw new Error('cryptoURL is missing')
// Create
const image = 'https://img.shields.io/badge/crypto-donate-yellow.svg'
const alt = 'crypto donate button'
const title = 'Donate to this project using Cryptocurrency'
return badge({ image, alt, url, title })
// Check
const url = cryptoURL || bitcoinURL;
if (!url)
throw new Error('cryptoURL is missing');
// Create
const image = 'https://img.shields.io/badge/crypto-donate-yellow.svg';
const alt = 'crypto donate button';
const title = 'Donate to this project using Cryptocurrency';
return badge({ image, alt, url, title });
}
crypto.badgeCategory = 'funding'
crypto.badgeCategory = 'funding';
/** @deprecated */
export function bitcoin(opts) {
return crypto(opts)
return crypto(opts);
}
bitcoin.badgeCategory = 'funding'
bitcoin.badgeCategory = 'funding';
/** Wishlist Badge */
export function wishlist({ wishlistURL }) {
// Check
if (!wishlistURL) throw new Error('wishlistURL is missing')
// Create
const image = 'https://img.shields.io/badge/wishlist-donate-yellow.svg'
const url = wishlistURL
const alt = 'Wishlist browse button'
const title = 'Buy an item on our wishlist for us'
return badge({ image, alt, url, title })
// Check
if (!wishlistURL)
throw new Error('wishlistURL is missing');
// Create
const image = 'https://img.shields.io/badge/wishlist-donate-yellow.svg';
const url = wishlistURL;
const alt = 'Wishlist browse button';
const title = 'Buy an item on our wishlist for us';
return badge({ image, alt, url, title });
}
wishlist.badgeCategory = 'funding'
wishlist.badgeCategory = 'funding';
/** Buy Me A Coffee Badge */
export function buymeacoffee({ buymeacoffeeUsername, buymeacoffeeURL }) {
// Check
if (!buymeacoffeeURL) {
if (!buymeacoffeeUsername)
throw new Error('buymeacoffeeUsername is missing')
buymeacoffeeURL = `https://buymeacoffee.com/${buymeacoffeeUsername}`
}
// Create
const image =
'https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg'
const url = buymeacoffeeURL
const alt = 'Buy Me A Coffee donate button'
const title = 'Donate to this project using Buy Me A Coffee'
return badge({ image, alt, url, title })
export function buymeacoffee({ buymeacoffeeUsername, buymeacoffeeURL, }) {
// Check
if (!buymeacoffeeURL) {
if (!buymeacoffeeUsername)
throw new Error('buymeacoffeeUsername is missing');
buymeacoffeeURL = `https://buymeacoffee.com/${buymeacoffeeUsername}`;
}
// Create
const image = 'https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg';
const url = buymeacoffeeURL;
const alt = 'Buy Me A Coffee donate button';
const title = 'Donate to this project using Buy Me A Coffee';
return badge({ image, alt, url, title });
}
buymeacoffee.badgeCategory = 'funding'
buymeacoffee.badgeCategory = 'funding';
/** Liberapay Badge */
export function liberapay({ liberapayUsername, liberapayURL }) {
// Check
if (!liberapayURL) {
if (!liberapayUsername) throw new Error('liberapayUsername is missing')
liberapayURL = `https://liberapay.com/${liberapayUsername}`
}
// Create
const image = 'https://img.shields.io/badge/liberapay-donate-yellow.svg'
const url = liberapayURL
const alt = 'Liberapay donate button'
const title = 'Donate to this project using Liberapay'
return badge({ image, alt, url, title })
export function liberapay({ liberapayUsername, liberapayURL, }) {
// Check
if (!liberapayURL) {
if (!liberapayUsername)
throw new Error('liberapayUsername is missing');
liberapayURL = `https://liberapay.com/${liberapayUsername}`;
}
// Create
const image = 'https://img.shields.io/badge/liberapay-donate-yellow.svg';
const url = liberapayURL;
const alt = 'Liberapay donate button';
const title = 'Donate to this project using Liberapay';
return badge({ image, alt, url, title });
}
liberapay.badgeCategory = 'funding'
liberapay.badgeCategory = 'funding';
/** Thanks App Badge */
export function thanksapp({
npmPackageName,
githubSlug,
thanksappUsername,
thanksappURL,
}) {
// Check
if (!thanksappURL) {
if (thanksappUsername) {
thanksappURL = `https://givethanks.app/u/${thanksappUsername}`
} else if (npmPackageName) {
thanksappURL = `https://givethanks.app/donate/npm/${npmPackageName}`
} else if (githubSlug) {
thanksappURL = `https://givethanks.app/donate/github/${githubSlug}`
} else {
throw new Error(
'at least one of these is required: thanksappUsername, npmPackageName, githubSlug'
)
}
}
// Create
const image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg'
const url = thanksappURL
const alt = 'Thanks App donate button'
const title = 'Donate to this project using Thanks App'
return badge({ image, alt, url, title })
export function thanksapp({ npmPackageName, githubSlug, thanksappUsername, thanksappURL, }) {
// Check
if (!thanksappURL) {
if (thanksappUsername) {
thanksappURL = `https://givethanks.app/u/${thanksappUsername}`;
}
else if (npmPackageName) {
thanksappURL = `https://givethanks.app/donate/npm/${npmPackageName}`;
}
else if (githubSlug) {
thanksappURL = `https://givethanks.app/donate/github/${githubSlug}`;
}
else {
throw new Error('at least one of these is required: thanksappUsername, npmPackageName, githubSlug');
}
}
// Create
const image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg';
const url = thanksappURL;
const alt = 'Thanks App donate button';
const title = 'Donate to this project using Thanks App';
return badge({ image, alt, url, title });
}
thanksapp.badgeCategory = 'funding'
thanksapp.badgeCategory = 'funding';
/** Boost Lab Badge */
export function boostlab({ githubSlug }) {
// Check
if (!githubSlug) throw new Error('githubSlug is missing')
// Create
const image = 'https://img.shields.io/badge/boostlab-donate-yellow.svg'
const url = `https://boost-lab.app/${githubSlug}`
const alt = 'Boost Lab donate button'
const title = 'Donate to this project using Boost Lab'
return badge({ image, alt, url, title })
// Check
if (!githubSlug)
throw new Error('githubSlug is missing');
// Create
const image = 'https://img.shields.io/badge/boostlab-donate-yellow.svg';
const url = `https://boost-lab.app/${githubSlug}`;
const alt = 'Boost Lab donate button';
const title = 'Donate to this project using Boost Lab';
return badge({ image, alt, url, title });
}
boostlab.badgeCategory = 'funding'
boostlab.badgeCategory = 'funding';
/** Slackin Script Badge */
export function slackinscript({ slackinURL }) {
// Check
if (!slackinURL) throw new Error('slackinURL is missing')
// Create
return `<script async defer src="${slackinURL}/slackin.js"></script>`
// Check
if (!slackinURL)
throw new Error('slackinURL is missing');
// Create
return `<script async defer src="${slackinURL}/slackin.js"></script>`;
}
slackinscript.badgeCategory = 'social'
slackinscript.badgeScript = true
slackinscript.badgeCategory = 'social';
slackinscript.badgeScript = true;
/** Slackin Badge */
export function slackin({ slackinURL }) {
// Check
if (!slackinURL) throw new Error('slackinURL is missing')
// Create
const image = `${slackinURL}/badge.svg`
const url = slackinURL
const alt = 'Slack community badge'
const title = "Join this project's slack community"
return badge({ image, alt, url, title })
// Check
if (!slackinURL)
throw new Error('slackinURL is missing');
// Create
const image = `${slackinURL}/badge.svg`;
const url = slackinURL;
const alt = 'Slack community badge';
const title = "Join this project's slack community";
return badge({ image, alt, url, title });
}
slackin.badgeCategory = 'social'
slackin.badgeCategory = 'social';
/**

@@ -474,138 +503,132 @@ * Google Analytics Beacon Badge

*/
export function gabeacon({ gaTrackingID, githubSlug }) {
// Check
if (!gaTrackingID) throw new Error('gaTrackingID is missing')
if (!githubSlug) throw new Error('githubSlug is missing')
// Create
const image = `https://ga-beacon.appspot.com/${gaTrackingID}/${githubSlug}`
const url = 'https://github.com/igrigorik/ga-beacon'
const alt = 'Google Analytics beacon image'
const title = 'Get Google Analytics for your project'
return badge({ image, alt, url, title })
export function gabeacon({ gaTrackingID, githubSlug, }) {
// Check
if (!gaTrackingID)
throw new Error('gaTrackingID is missing');
if (!githubSlug)
throw new Error('githubSlug is missing');
// Create
const image = `https://ga-beacon.appspot.com/${gaTrackingID}/${githubSlug}`;
const url = 'https://github.com/igrigorik/ga-beacon';
const alt = 'Google Analytics beacon image';
const title = 'Get Google Analytics for your project';
return badge({ image, alt, url, title });
}
gabeacon.badgeCategory = 'social'
gabeacon.badgeCategory = 'social';
/** Google Plus One Button */
export function googleplusone({ homepage }) {
// Check
if (!homepage) throw new Error('homepage is missing')
// Create
return `<span class="g-plusone" data-size="medium" data-href="${homepage}"></span><script>(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = '//apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();</script>`
// Check
if (!homepage)
throw new Error('homepage is missing');
// Create
return `<span class="g-plusone" data-size="medium" data-href="${homepage}"></span><script>(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = '//apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();</script>`;
}
googleplusone.badgeCategory = 'social'
googleplusone.badgeScript = true
googleplusone.badgeCategory = 'social';
googleplusone.badgeScript = true;
/** Reddit Submit Button */
export function redditsubmit({ homepage }) {
// Check
if (!homepage) throw new Error('homepage is missing')
// Create
return `<script>reddit_url="${homepage}"</script><script src="https://en.reddit.com/static/button/button1.js"></script>`
// Check
if (!homepage)
throw new Error('homepage is missing');
// Create
return `<script>reddit_url="${homepage}"</script><script src="https://en.reddit.com/static/button/button1.js"></script>`;
}
redditsubmit.badgeCategory = 'social'
redditsubmit.badgeScript = true
redditsubmit.badgeCategory = 'social';
redditsubmit.badgeScript = true;
/** Hacker News Submit Button */
export function hackernewssubmit({ homepage }) {
// Check
if (!homepage) throw new Error('homepage is missing')
// Create
return `<a href="https://news.ycombinator.com/submit" class="hn-button" data-url="${homepage}" data-count="horizontal">Vote on Hacker News</a><script>var HN=[];HN.factory=function(e){return function(){HN.push([e].concat(Array.prototype.slice.call(arguments,0)))};},HN.on=HN.factory("on"),HN.once=HN.factory("once"),HN.off=HN.factory("off"),HN.emit=HN.factory("emit"),HN.load=function(){var e="hn-button.js";if(document.getElementById(e))return;var t=document.createElement("script");t.id=e,t.src="https://hn-button.herokuapp.com/hn-button.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)},HN.load();</script>`
// Check
if (!homepage)
throw new Error('homepage is missing');
// Create
return `<a href="https://news.ycombinator.com/submit" class="hn-button" data-url="${homepage}" data-count="horizontal">Vote on Hacker News</a><script>var HN=[];HN.factory=function(e){return function(){HN.push([e].concat(Array.prototype.slice.call(arguments,0)))};},HN.on=HN.factory("on"),HN.once=HN.factory("once"),HN.off=HN.factory("off"),HN.emit=HN.factory("emit"),HN.load=function(){var e="hn-button.js";if(document.getElementById(e))return;var t=document.createElement("script");t.id=e,t.src="https://hn-button.herokuapp.com/hn-button.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)},HN.load();</script>`;
}
hackernewssubmit.badgeCategory = 'social'
hackernewssubmit.badgeScript = true
hackernewssubmit.badgeCategory = 'social';
hackernewssubmit.badgeScript = true;
/** Facebook Like Button */
export function facebooklike({ homepage, facebookApplicationID }) {
// Prepare
if (!homepage) throw new Error('homepage is missing')
facebookApplicationID = facebookApplicationID || env.FACEBOOK_APPLICATION_ID
if (!facebookApplicationID)
throw new Error('facebookApplicationID is missing')
// Return
return `<iframe src="https://www.facebook.com/plugins/like.php?href=${escape(
homepage
)}&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=${escape(
facebookApplicationID
)}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>`
export function facebooklike({ homepage, facebookApplicationID, }) {
// Prepare
if (!homepage)
throw new Error('homepage is missing');
facebookApplicationID = facebookApplicationID || env.FACEBOOK_APPLICATION_ID;
if (!facebookApplicationID)
throw new Error('facebookApplicationID is missing');
// Return
return `<iframe src="https://www.facebook.com/plugins/like.php?href=${escape(homepage)}&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=${escape(facebookApplicationID)}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>`;
}
facebooklike.badgeCategory = 'social'
facebooklike.badgeScript = true
facebooklike.badgeCategory = 'social';
facebooklike.badgeScript = true;
/** Facebook Follow Button */
export function facebookfollow({ facebookUsername, facebookApplicationID }) {
// Prepare
if (!facebookUsername) throw new Error('facebookUsername is missing')
facebookApplicationID = facebookApplicationID || env.FACEBOOK_APPLICATION_ID
if (!facebookApplicationID)
throw new Error('facebookApplicationID is missing')
// Return
return `<iframe src="https://www.facebook.com/plugins/follow.php?href=https%3A%2F%2Fwww.facebook.com%2F${escape(
facebookUsername
)}&amp;layout=button_count&amp;show_faces=false&amp;colorscheme=light&amp;font&amp;width=450&amp;appId=${escape(
facebookApplicationID
)}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height: 20px;" allowTransparency="true"></iframe>`
export function facebookfollow({ facebookUsername, facebookApplicationID, }) {
// Prepare
if (!facebookUsername)
throw new Error('facebookUsername is missing');
facebookApplicationID = facebookApplicationID || env.FACEBOOK_APPLICATION_ID;
if (!facebookApplicationID)
throw new Error('facebookApplicationID is missing');
// Return
return `<iframe src="https://www.facebook.com/plugins/follow.php?href=https%3A%2F%2Fwww.facebook.com%2F${escape(facebookUsername)}&amp;layout=button_count&amp;show_faces=false&amp;colorscheme=light&amp;font&amp;width=450&amp;appId=${escape(facebookApplicationID)}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height: 20px;" allowTransparency="true"></iframe>`;
}
facebookfollow.badgeCategory = 'social'
facebookfollow.badgeScript = true
facebookfollow.badgeCategory = 'social';
facebookfollow.badgeScript = true;
/** Twitter Tweet Button */
export function twittertweet({ twitterUsername }) {
// Prepare
if (!twitterUsername) throw new Error('twitterUsername is missing')
// Return
return `<a href="https://twitter.com/share" class="twitter-share-button" data-via="${twitterUsername}" data-related="${twitterUsername}">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>`
// Prepare
if (!twitterUsername)
throw new Error('twitterUsername is missing');
// Return
return `<a href="https://twitter.com/share" class="twitter-share-button" data-via="${twitterUsername}" data-related="${twitterUsername}">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>`;
}
twittertweet.badgeCategory = 'social'
twittertweet.badgeScript = true
twittertweet.badgeCategory = 'social';
twittertweet.badgeScript = true;
/** Twitter Follow Button */
export function twitterfollow({ twitterUsername }) {
// Prepare
if (!twitterUsername) throw new Error('twitterUsername is missing')
// Return
return `<a href="https://twitter.com/${escape(
twitterUsername
)}" class="twitter-follow-button" data-show-count="false">Follow @${twitterUsername}</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>`
// Prepare
if (!twitterUsername)
throw new Error('twitterUsername is missing');
// Return
return `<a href="https://twitter.com/${escape(twitterUsername)}" class="twitter-follow-button" data-show-count="false">Follow @${twitterUsername}</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>`;
}
twitterfollow.badgeCategory = 'social'
twitterfollow.badgeScript = true
twitterfollow.badgeCategory = 'social';
twitterfollow.badgeScript = true;
/** Github Follow Button */
export function githubfollow({ githubUsername }) {
// Prepare
if (!githubUsername) throw new Error('githubUsername is missing')
// Return
return `<iframe src="https://ghbtns.com/github-btn.html?user=${escape(
githubUsername
)}&amp;type=follow&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="165" height="20"></iframe>`
export function githubfollow({ githubUsername, }) {
// Prepare
if (!githubUsername)
throw new Error('githubUsername is missing');
// Return
return `<iframe src="https://ghbtns.com/github-btn.html?user=${escape(githubUsername)}&amp;type=follow&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="165" height="20"></iframe>`;
}
githubfollow.badgeCategory = 'social'
githubfollow.badgeScript = true
githubfollow.badgeCategory = 'social';
githubfollow.badgeScript = true;
/** GitHub Star Button */
export function githubstar({ githubSlug }) {
// Prepare
if (!githubSlug) throw new Error('githubSlug is missing')
const split = githubSlug.split('/')
const githubUsername = split[0]
const githubRepository = split[1]
if (!githubUsername || !githubRepository)
throw new Error('githubSlug is invalid')
// Return
return `<iframe src="https://ghbtns.com/github-btn.html?user=${escape(
githubUsername
)}&amp;repo=${escape(
githubRepository
)}&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>`
// Prepare
if (!githubSlug)
throw new Error('githubSlug is missing');
const split = githubSlug.split('/');
const githubUsername = split[0];
const githubRepository = split[1];
if (!githubUsername || !githubRepository)
throw new Error('githubSlug is invalid');
// Return
return `<iframe src="https://ghbtns.com/github-btn.html?user=${escape(githubUsername)}&amp;repo=${escape(githubRepository)}&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>`;
}
githubstar.badgeCategory = 'social'
githubstar.badgeScript = true
githubstar.badgeCategory = 'social';
githubstar.badgeScript = true;
/** Quora Follow Button */
export function quorafollow({ quoraUsername, quoraRealname, quoraCode }) {
// Prepare
if (!quoraUsername) throw new Error('quoraUsername is missing')
quoraRealname = quoraRealname || quoraUsername.replace(/-/g, ' ')
quoraCode = quoraCode || '7N31XJs'
// Return
return `
export function quorafollow({ quoraUsername, quoraRealname, quoraCode, }) {
// Prepare
if (!quoraUsername)
throw new Error('quoraUsername is missing');
quoraRealname = quoraRealname || quoraUsername.replace(/-/g, ' ');
quoraCode = quoraCode || '7N31XJs';
// Return
return `
<span data-name="${quoraUsername}">
Follow <a href="http://www.quora.com/${quoraUsername}">${quoraRealname}</a> on <a href="http://www.quora.com">Quora</a>
<script src="https://www.quora.com/widgets/follow?embed_code=${escape(
quoraCode
)}"></script>
</span>`.replace(/\n\s*/g, '')
<script src="https://www.quora.com/widgets/follow?embed_code=${escape(quoraCode)}"></script>
</span>`.replace(/\n\s*/g, '');
}
quorafollow.badgeCategory = 'social'
quorafollow.badgeScript = true
quorafollow.badgeCategory = 'social';
quorafollow.badgeScript = true;
// Import
import * as badges from './badges.js'
export { badges }
import * as badges from './badges.js';
export { badges };
/**

@@ -12,16 +12,17 @@ * Render a specified badge with the appropriate wrapping (div if block badge, span if inline badge)

export function renderBadge(badgeName, config = {}) {
if (badgeName === '---') {
return '<br class="badge-separator" />'
}
// Fetch
// @ts-ignore
const badgeMethod = badges[badgeName]
// Send the badge value and options to the render method
const badgeResult = badgeMethod(config).trim()
if (!badgeResult) return ''
// We have a result, so let's wrap it
const elementName = badgeMethod.badgeInline === false ? 'div' : 'span'
const wrappedResult = `<${elementName} class="badge-${badgeName}">${badgeResult}</${elementName}>`
// Done
return wrappedResult
if (badgeName === '---') {
return '<br class="badge-separator" />';
}
// Fetch
// @ts-ignore
const badgeMethod = badges[badgeName];
// Send the badge value and options to the render method
const badgeResult = badgeMethod(config).trim();
if (!badgeResult)
return '';
// We have a result, so let's wrap it
const elementName = badgeMethod.badgeInline === false ? 'div' : 'span';
const wrappedResult = `<${elementName} class="badge-${badgeName}">${badgeResult}</${elementName}>`;
// Done
return wrappedResult;
}

@@ -35,49 +36,46 @@ /**

*/
export function renderBadges(
list,
config = {},
options = { filterCategory: false, filterScripts: true }
) {
// Prepare
const results = []
// Render the badges
list.forEach(function (badgeName) {
let badgeConfig = config
// Custom Config?
if (Array.isArray(badgeName)) {
badgeConfig = badgeName[1]
badgeName = badgeName[0]
}
// Seperator?
if (badgeName === '---') {
// Do not render seperators if we only wanted a single category
if (options.filterCategory) return
}
// Exists?
else {
// @ts-ignore
const badge = badges[badgeName]
if (badge) {
// Category?
if (
options.filterCategory &&
options.filterCategory !== badge.badgeCategory
)
return
// Script?
if (options.filterScripts && badge.badgeScript) return
}
// Doesn't exist
else {
throw new Error(`the badge ${badgeName} does not exist`)
}
}
// Render
const badgeResult = renderBadge(badgeName, badgeConfig).trim()
if (!badgeResult) return
// Rendered successfully, add the result
results.push(badgeResult)
})
// Return
return results.join('\n')
export function renderBadges(list, config = {}, options = { filterCategory: false, filterScripts: true }) {
// Prepare
const results = [];
// Render the badges
list.forEach(function (badgeName) {
let badgeConfig = config;
// Custom Config?
if (Array.isArray(badgeName)) {
badgeConfig = badgeName[1];
badgeName = badgeName[0];
}
// Seperator?
if (badgeName === '---') {
// Do not render seperators if we only wanted a single category
if (options.filterCategory)
return;
}
// Exists?
else {
// @ts-ignore
const badge = badges[badgeName];
if (badge) {
// Category?
if (options.filterCategory &&
options.filterCategory !== badge.badgeCategory)
return;
// Script?
if (options.filterScripts && badge.badgeScript)
return;
}
// Doesn't exist
else {
throw new Error(`the badge ${badgeName} does not exist`);
}
}
// Render
const badgeResult = renderBadge(badgeName, badgeConfig).trim();
if (!badgeResult)
return;
// Rendered successfully, add the result
results.push(badgeResult);
});
// Return
return results.join('\n');
}

@@ -361,2 +361,38 @@ // Import

interface githubworkflowOptions extends githubSlugOptions {
/** The name or location of the workflow file to show the badge for */
githubWorkflow: string
/** The branch to constrain the badge to */
githubBranch?: string
/** The event to constrain the badge to */
githubEvent?: string
}
/** Github Workflow Badge */
export function githubworkflow({
githubWorkflow,
githubBranch,
githubEvent,
githubSlug,
}: githubworkflowOptions): string {
// Check
if (!githubSlug) throw new Error('githubSlug is missing')
if (!githubWorkflow) throw new Error('githubWorkflow is missing')
// Create
// https://shields.io/category/build
// https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/adding-a-workflow-status-badge#using-a-workflow-name
const image = new URL(
`https://github.com/${githubSlug}/workflows/${githubWorkflow}/badge.svg`
)
if (githubBranch) image.searchParams.set('branch', githubBranch)
if (githubEvent) image.searchParams.set('event', githubEvent)
const link = new URL(`https://github.com/${githubSlug}/actions`)
link.searchParams.set('query', `workflow:${githubWorkflow}`)
const alt = `Status of the GitHub Workflow: ${githubWorkflow}`
const title = `View the status of this project's GitHub Workflow: ${githubWorkflow}`
return badge({ image: image.toString(), url: link.toString(), alt, title })
}
githubworkflow.badgeCategory = 'testing'
// ====================================

@@ -363,0 +399,0 @@ // Funding Badges

# History
## v4.24.0 2020 November 23
- Add the `githubworkflow` badge for use with your GitHub Action Workflows
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
## v4.23.0 2020 October 29

@@ -4,0 +9,0 @@

{
"name": "badges",
"version": "4.23.0",
"version": "4.24.0-next.1606109393.2103272a423a672a339752671141163950f496c9",
"description": "The definitive collection of badges for rendering",

@@ -23,9 +23,5 @@ "homepage": "https://github.com/bevry/badges",

"david dm",
"deno",
"deno-edition",
"deno-entry",
"denoland",
"donate",
"donation",
"esnext",
"es2017",
"facebook",

@@ -88,3 +84,2 @@ "facebook follow",

"list": [
"travisci",
"npmversion",

@@ -115,3 +110,2 @@ "npmdownloads",

"wishlistURL": "https://bevry.me/wishlist",
"travisTLD": "com",
"githubUsername": "bevry",

@@ -169,4 +163,4 @@ "githubRepository": "badges",

{
"description": "TypeScript compiled against ESNext for Node.js 10 || 12 || 14 || 15 with Require for modules",
"directory": "edition-esnext",
"description": "TypeScript compiled against ES2017 for Node.js 10 || 12 || 14 || 15 with Require for modules",
"directory": "edition-es2017",
"entry": "index.js",

@@ -176,3 +170,3 @@ "tags": [

"javascript",
"esnext",
"es2017",
"require"

@@ -186,4 +180,4 @@ ],

{
"description": "TypeScript compiled against ESNext for Node.js 12 || 14 || 15 with Import for modules",
"directory": "edition-esnext-esm",
"description": "TypeScript compiled against ES2017 for Node.js 12 || 14 || 15 with Import for modules",
"directory": "edition-es2017-esm",
"entry": "index.js",

@@ -193,3 +187,3 @@ "tags": [

"javascript",
"esnext",
"es2017",
"import"

@@ -201,16 +195,2 @@ ],

}
},
{
"description": "TypeScript source code made to be compatible with Deno",
"directory": "edition-deno",
"entry": "index.ts",
"tags": [
"typescript",
"import",
"deno"
],
"engines": {
"deno": true,
"browsers": true
}
}

@@ -220,7 +200,7 @@ ],

"type": "module",
"main": "edition-esnext/index.js",
"main": "edition-es2017/index.js",
"exports": {
"node": {
"import": "./edition-esnext-esm/index.js",
"require": "./edition-esnext/index.js"
"import": "./edition-es2017-esm/index.js",
"require": "./edition-es2017/index.js"
},

@@ -231,31 +211,30 @@ "browser": {

},
"deno": "edition-deno/index.ts",
"browser": "edition-browsers/index.js",
"module": "edition-browsers/index.js",
"devDependencies": {
"@bevry/update-contributors": "^1.17.0",
"@typescript-eslint/eslint-plugin": "^4.6.0",
"@typescript-eslint/parser": "^4.6.0",
"assert-helpers": "^8.0.1",
"eslint": "^7.12.1",
"eslint-config-bevry": "^3.22.0",
"@bevry/update-contributors": "^1.18.0",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"assert-helpers": "^8.1.0",
"eslint": "^7.14.0",
"eslint-config-bevry": "^3.23.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"kava": "^5.12.0",
"kava": "^5.13.0",
"make-deno-edition": "^1.2.0",
"prettier": "^2.1.2",
"projectz": "^2.16.0",
"surge": "^0.21.6",
"prettier": "^2.2.0",
"projectz": "^2.17.0",
"surge": "^0.21.7",
"typedoc": "^0.19.2",
"typescript": "^4.0.5",
"valid-directory": "^3.4.0",
"valid-module": "^1.14.0"
"typescript": "^4.1.2",
"valid-directory": "^3.5.0",
"valid-module": "^1.15.0"
},
"scripts": {
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next",
"our:compile": "npm run our:compile:deno && npm run our:compile:edition-browsers && npm run our:compile:edition-esnext && npm run our:compile:edition-esnext-esm && npm run our:compile:types",
"our:compile": "npm run our:compile:deno && npm run our:compile:edition-browsers && npm run our:compile:edition-es2017 && npm run our:compile:edition-es2017-esm && npm run our:compile:types",
"our:compile:deno": "make-deno-edition --attempt",
"our:compile:edition-browsers": "tsc --module ESNext --target ES2019 --outDir ./edition-browsers --project tsconfig.json && ( test ! -d edition-browsers/source || ( mv edition-browsers/source edition-temp && rm -Rf edition-browsers && mv edition-temp edition-browsers ) )",
"our:compile:edition-esnext": "tsc --module commonjs --target ESNext --outDir ./edition-esnext --project tsconfig.json && ( test ! -d edition-esnext/source || ( mv edition-esnext/source edition-temp && rm -Rf edition-esnext && mv edition-temp edition-esnext ) ) && echo '{\"type\": \"commonjs\"}' > edition-esnext/package.json",
"our:compile:edition-esnext-esm": "tsc --module ESNext --target ESNext --outDir ./edition-esnext-esm --project tsconfig.json && ( test ! -d edition-esnext-esm/source || ( mv edition-esnext-esm/source edition-temp && rm -Rf edition-esnext-esm && mv edition-temp edition-esnext-esm ) ) && echo '{\"type\": \"module\"}' > edition-esnext-esm/package.json",
"our:compile:edition-es2017": "tsc --module commonjs --target ES2017 --outDir ./edition-es2017 --project tsconfig.json && ( test ! -d edition-es2017/source || ( mv edition-es2017/source edition-temp && rm -Rf edition-es2017 && mv edition-temp edition-es2017 ) ) && echo '{\"type\": \"commonjs\"}' > edition-es2017/package.json",
"our:compile:edition-es2017-esm": "tsc --module ESNext --target ES2017 --outDir ./edition-es2017-esm --project tsconfig.json && ( test ! -d edition-es2017-esm/source || ( mv edition-es2017-esm/source edition-temp && rm -Rf edition-es2017-esm && mv edition-temp edition-es2017-esm ) ) && echo '{\"type\": \"module\"}' > edition-es2017-esm/package.json",
"our:compile:types": "tsc --project tsconfig.json --emitDeclarationOnly --declaration --declarationMap --declarationDir ./compiled-types && ( test ! -d compiled-types/source || ( mv compiled-types/source edition-temp && rm -Rf compiled-types && mv edition-temp compiled-types ) )",

@@ -282,3 +261,3 @@ "our:deploy": "echo no need for this project",

"our:verify:prettier": "prettier --write .",
"test": "node ./edition-esnext/test.js"
"test": "node ./edition-es2017/test.js"
},

@@ -285,0 +264,0 @@ "eslintConfig": {

@@ -10,3 +10,2 @@ <!-- TITLE/ -->

<span class="badge-travisci"><a href="http://travis-ci.com/bevry/badges" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/com/bevry/badges/master.svg" alt="Travis CI Build Status" /></a></span>
<span class="badge-npmversion"><a href="https://npmjs.org/package/badges" title="View this project on NPM"><img src="https://img.shields.io/npm/v/badges.svg" alt="NPM version" /></a></span>

@@ -182,8 +181,2 @@ <span class="badge-npmdownloads"><a href="https://npmjs.org/package/badges" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/badges.svg" alt="NPM downloads" /></a></span>

<a href="https://deno.land" title="Deno is a secure runtime for JavaScript and TypeScript, it is an alternative for Node.js"><h3>Deno</h3></a>
``` typescript
import * as pkg from 'https://unpkg.com/badges@^4.23.0/edition-deno/index.ts'
```
<a href="https://www.skypack.dev" title="Skypack is a JavaScript Delivery Network for modern web apps"><h3>Skypack</h3></a>

@@ -193,3 +186,3 @@

<script type="module">
import * as pkg from '//cdn.skypack.dev/badges@^4.23.0'
import * as pkg from '//cdn.skypack.dev/badges@^4.24.0'
</script>

@@ -202,3 +195,3 @@ ```

<script type="module">
import * as pkg from '//unpkg.com/badges@^4.23.0'
import * as pkg from '//unpkg.com/badges@^4.24.0'
</script>

@@ -211,3 +204,3 @@ ```

<script type="module">
import * as pkg from '//dev.jspm.io/badges@4.23.0'
import * as pkg from '//dev.jspm.io/badges@4.24.0'
</script>

@@ -222,6 +215,5 @@ ```

<li><code>badges/edition-browsers/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#10th_Edition_-_ECMAScript_2019" title="ECMAScript ES2019">ES2019</a> for web browsers with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li>
<li><code>badges</code> aliases <code>badges/edition-esnext/index.js</code></li>
<li><code>badges/edition-esnext/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#ES.Next" title="ECMAScript Next">ESNext</a> for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 10 || 12 || 14 || 15 with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li>
<li><code>badges/edition-esnext-esm/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#ES.Next" title="ECMAScript Next">ESNext</a> for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 12 || 14 || 15 with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li>
<li><code>badges/edition-deno/index.ts</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> source code made to be compatible with <a href="https://deno.land" title="Deno is a secure runtime for JavaScript and TypeScript, it is an alternative to Node.js">Deno</a></li></ul>
<li><code>badges</code> aliases <code>badges/edition-es2017/index.js</code></li>
<li><code>badges/edition-es2017/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#8th_Edition_-_ECMAScript_2017" title="ECMAScript ES2017">ES2017</a> for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 10 || 12 || 14 || 15 with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li>
<li><code>badges/edition-es2017-esm/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#8th_Edition_-_ECMAScript_2017" title="ECMAScript ES2017">ES2017</a> for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 12 || 14 || 15 with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li></ul>

@@ -228,0 +220,0 @@ <!-- /INSTALL -->

@@ -361,2 +361,38 @@ // Import

interface githubworkflowOptions extends githubSlugOptions {
/** The name or location of the workflow file to show the badge for */
githubWorkflow: string
/** The branch to constrain the badge to */
githubBranch?: string
/** The event to constrain the badge to */
githubEvent?: string
}
/** Github Workflow Badge */
export function githubworkflow({
githubWorkflow,
githubBranch,
githubEvent,
githubSlug,
}: githubworkflowOptions): string {
// Check
if (!githubSlug) throw new Error('githubSlug is missing')
if (!githubWorkflow) throw new Error('githubWorkflow is missing')
// Create
// https://shields.io/category/build
// https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/adding-a-workflow-status-badge#using-a-workflow-name
const image = new URL(
`https://github.com/${githubSlug}/workflows/${githubWorkflow}/badge.svg`
)
if (githubBranch) image.searchParams.set('branch', githubBranch)
if (githubEvent) image.searchParams.set('event', githubEvent)
const link = new URL(`https://github.com/${githubSlug}/actions`)
link.searchParams.set('query', `workflow:${githubWorkflow}`)
const alt = `Status of the GitHub Workflow: ${githubWorkflow}`
const title = `View the status of this project's GitHub Workflow: ${githubWorkflow}`
return badge({ image: image.toString(), url: link.toString(), alt, title })
}
githubworkflow.badgeCategory = 'testing'
// ====================================

@@ -363,0 +399,0 @@ // Funding Badges

@@ -9,4 +9,3 @@ {

"strict": true,
"target": "ESNext",
"lib": ["ESNext"],
"target": "ES2017",
"module": "ESNext"

@@ -13,0 +12,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc