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 2.3.0 to 3.0.0-next.1575629350.eaa08ac98c4f4b0013f581e424438f7061e96e56

edition-node-12/badges.js

634

edition-browsers/badges.js

@@ -1,21 +0,56 @@

'use strict'; // Import
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.badge = badge;
exports.shields = shields;
exports.npmversion = npmversion;
exports.npmdownloads = npmdownloads;
exports.daviddm = daviddm;
exports.daviddmdev = daviddmdev;
exports.nodeico = nodeico;
exports.saucelabsbm = saucelabsbm;
exports.saucelabs = saucelabs;
exports.travisci = travisci;
exports.codeship = codeship;
exports.coveralls = coveralls;
exports.codeclimate = codeclimate;
exports.bithound = bithound;
exports.waffle = waffle;
exports.sixtydevstips = sixtydevstips;
exports.githubsponsors = githubsponsors;
exports.patreon = patreon;
exports.opencollective = opencollective;
exports.gratipay = gratipay;
exports.flattr = flattr;
exports.paypal = paypal;
exports.crypto = crypto;
exports.bitcoin = bitcoin;
exports.wishlist = wishlist;
exports.buymeacoffee = buymeacoffee;
exports.liberapay = liberapay;
exports.thanksapp = thanksapp;
exports.boostlab = boostlab;
exports.slackinscript = slackinscript;
exports.slackin = slackin;
exports.gabeacon = gabeacon;
exports.googleplusone = googleplusone;
exports.redditsubmit = redditsubmit;
exports.hackernewssubmit = hackernewssubmit;
exports.facebooklike = facebooklike;
exports.facebookfollow = facebookfollow;
exports.twittertweet = twittertweet;
exports.twitterfollow = twitterfollow;
exports.githubfollow = githubfollow;
exports.githubstar = githubstar;
exports.quorafollow = quorafollow;
var querystring = require('querystring'); // ====================================
// Custom Badges
var _querystring = _interopRequireDefault(require("querystring"));
/**
* Generate a HTML badge
* @private
* @method badge
* @param {Object} opts
* @param {string} opts.image The URL to the image
* @param {string} [opts.alt] The alt attribute for the image
* @param {string} [opts.url] The URL for the link
* @param {string} [opts.title] The title attribute for the link
* @return {string} the result badge
*/
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/** Generate a HTML badge */
function badge(_ref) {

@@ -39,15 +74,4 @@ var image = _ref.image,

badge.badgeCategory = 'custom';
/**
* Shields Custom Badge
* @method shields
* @param {Object} opts
* @param {string} opts.left The text for the left side of the badge
* @param {string} opts.right The text for the right side of the badge
* @param {string} [opts.color='yellow'] The color for the badge
* @param {string} [opts.alt] The alt attribute for the image
* @param {string} [opts.url] The URL for the link
* @param {string} [opts.title] The title attribute for the link
* @return {string} the result badge
*/
/** Shields Custom Badge */
function shields(_ref2) {

@@ -77,10 +101,3 @@ var left = _ref2.left,

/**
* NPM Version Badge
* @method npmversion
* @param {Object} opts
* @param {string} opts.npmPackageName The repository slug (username/reponame)
* @return {string} the result badge
*/
/** NPM Version Badge */
function npmversion(_ref3) {

@@ -104,9 +121,3 @@ var npmPackageName = _ref3.npmPackageName;

npmversion.badgeCategory = 'development';
/**
* NPM Downloads Badge
* @method npmdownloads
* @param {Object} opts
* @param {string} opts.npmPackageName The repository slug (username/reponame)
* @return {string} the result badge
*/
/** NPM Downloads Badge */

@@ -130,9 +141,3 @@ function npmdownloads(_ref4) {

npmdownloads.badgeCategory = 'development';
/**
* David DM Dependencies Badge
* @method daviddm
* @param {Object} opts
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @return {string} the result badge
*/
/** David DM Dependencies Badge */

@@ -157,9 +162,3 @@ function daviddm(_ref5) {

daviddm.badgeCategory = 'development';
/**
* David DM Dev Dependencies Badge
* @method daviddmdev
* @param {Object} opts
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @return {string} the result badge
*/
/** David DM Dev Dependencies Badge */

@@ -184,13 +183,4 @@ function daviddmdev(_ref6) {

daviddmdev.badgeCategory = 'development';
/**
* Nodei.co Badge
* @method nodeico
* @param {Object} opts
* @param {string} opts.npmPackageName
* @param {String|Object} [opts.nodeicoQueryString] 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.
* @return {string} the result badge
*/
/** Nodei.co Badge */
function nodeico(_ref7) {

@@ -211,3 +201,3 @@ var npmPackageName = _ref7.npmPackageName,

var image = "https://nodei.co/npm/".concat(npmPackageName, ".png");
var query = _typeof(nodeicoQueryString) === 'object' ? querystring.stringify(nodeicoQueryString) : nodeicoQueryString;
var query = _typeof(nodeicoQueryString) === 'object' ? _querystring.default.stringify(nodeicoQueryString) : nodeicoQueryString;
if (query) image += "?".concat(query);

@@ -225,10 +215,3 @@ return badge({

/**
* Sauce Labs Browser Matrix Badge
* @method saucelabsbm
* @param {Object} opts
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @return {string} the result badge
*/
/** Sauce Labs Browser Matrix Badge */
function saucelabsbm(_ref8) {

@@ -256,10 +239,3 @@ var saucelabsUsername = _ref8.saucelabsUsername,

saucelabsbm.badgeInline = false;
/**
* Sauce Labs Badge
* @method saucelabs
* @param {Object} opts
* @param {string} opts.saucelabsUsername The saucelabs username
* @param {string} opts.saucelabsAuthToken The saucelabs authorisation token
* @return {string} the result badge
*/
/** Sauce Labs Badge */

@@ -287,11 +263,4 @@ function saucelabs(_ref9) {

saucelabs.badgeCategory = 'testing';
/**
* Travis CI Badge
* @method travisci
* @param {Object} opts
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @param {string} [opts.travisTLD=org] The TLD to use for travis, use "com" if you have moved to travis-ci.com instead of travis-ci.org
* @return {string} the result badge
*/
/** Travis CI Badge */
function travisci(_ref10) {

@@ -319,11 +288,4 @@ var githubSlug = _ref10.githubSlug,

travisci.badgeCategory = 'testing';
/**
* Codeship Badge
* @method codeship
* @param {Object} opts
* @param {string} opts.codeshipProjectUUID The UUID for a specific project, which is available on the General tab in your project settings
* @param {string} opts.codeshipProjectID The ID for a specific project, which is available via the URL for the codeship project page
* @return {string} the result badge
*/
/** Codeship Badge */
function codeship(_ref11) {

@@ -349,9 +311,3 @@ var codeshipProjectUUID = _ref11.codeshipProjectUUID,

codeship.badgeCategory = 'testing';
/**
* Coveralls Badge
* @method coveralls
* @param {Object} opts
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @return {string} the result badge
*/
/** Coveralls Badge */

@@ -376,9 +332,3 @@ function coveralls(_ref12) {

coveralls.badgeCategory = 'testing';
/**
* Code Climate Rating Badge
* @method codeclimate
* @param {Object} opts
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @return {string} the result badge
*/
/** Code Climate Rating Badge */

@@ -403,9 +353,3 @@ function codeclimate(_ref13) {

codeclimate.badgeCategory = 'testing';
/**
* BitHound Score Badge
* @method bithound
* @param {Object} opts
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @return {string} the result badge
*/
/** BitHound Score Badge */

@@ -430,9 +374,3 @@ function bithound(_ref14) {

bithound.badgeCategory = 'testing';
/**
* Waffle Badge
* @method waffle
* @param {Object} opts
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @return {string} the result badge
*/
/** Waffle Badge */

@@ -460,11 +398,5 @@ function waffle(_ref15) {

/**
* 60devs Tips Badge
* @method sixtydevstips
* @param {Object} opts
* @param {string} opts.sixtydevsUsername The 60devs username to donate to
* @param {string} opts.sixtydevstipsURL The url to the 60devs donate page
* @return {string} the result badge
*/
/** At least one of the properties must be provided */
/** 60devs Tips Badge */
function sixtydevstips(_ref16) {

@@ -494,15 +426,36 @@ var sixtydevstipsID = _ref16.sixtydevstipsID,

sixtydevstips.badgeCategory = 'funding';
/**
* Patreon Badge
* @method patreon
* @param {Object} opts
* @param {string} opts.patreonUsername The Patreon username to donate to
* @param {string} opts.patreonURL The url to the Patreon donate page
* @return {string} the result badge
*/
/** At least one of the properties must be provided */
function patreon(_ref17) {
var patreonUsername = _ref17.patreonUsername,
patreonURL = _ref17.patreonURL;
/** Github Sponsors Badge */
function githubsponsors(_ref17) {
var githubSponsorsURL = _ref17.githubSponsorsURL,
githubSponsorsUsername = _ref17.githubSponsorsUsername,
githubUsername = _ref17.githubUsername;
if (!githubSponsorsURL) {
if (!githubSponsorsUsername && !githubUsername) throw new Error('githubSponsorsUsername and githubUsername are missing');
githubSponsorsURL = "https://github.com/sponsors/".concat(githubSponsorsUsername || githubUsername);
} // Create
var image = 'https://img.shields.io/badge/github-donate-yellow.svg';
var url = githubSponsorsURL;
var alt = 'GitHub Sponsors donate button';
var title = 'Donate to this project using GitHub Sponsors';
return badge({
image: image,
alt: alt,
url: url,
title: title
});
}
githubsponsors.badgeCategory = 'funding';
/** At least one of the properties must be provided */
/** Patreon Badge */
function patreon(_ref18) {
var patreonUsername = _ref18.patreonUsername,
patreonURL = _ref18.patreonURL;
// Check

@@ -528,14 +481,8 @@ if (!patreonURL) {

patreon.badgeCategory = 'funding';
/**
* Open Collective Badge
* @method opencollective
* @param {Object} opts
* @param {string} opts.opencollectiveUsername The Open Collective username to donate to
* @param {string} opts.opencollectiveURL The url to the Open Collective donate page
* @return {string} the result badge
*/
/** At least one of the properties must be provided */
function opencollective(_ref18) {
var opencollectiveUsername = _ref18.opencollectiveUsername,
opencollectiveURL = _ref18.opencollectiveURL;
/** Open Collective Badge */
function opencollective(_ref19) {
var opencollectiveUsername = _ref19.opencollectiveUsername,
opencollectiveURL = _ref19.opencollectiveURL;

@@ -562,14 +509,8 @@ // Check

opencollective.badgeCategory = 'funding';
/**
* Gratipay Badge
* @method gratipay
* @param {Object} opts
* @param {string} opts.gratipayUsername The Gratipay username to donate to
* @param {string} opts.gratipayURL The url to the Gratipay donate page
* @return {string} the result badge
*/
/** At least one of the properties must be provided */
function gratipay(_ref19) {
var gratipayUsername = _ref19.gratipayUsername,
gratipayURL = _ref19.gratipayURL;
/** Gratipay Badge */
function gratipay(_ref20) {
var gratipayUsername = _ref20.gratipayUsername,
gratipayURL = _ref20.gratipayURL;

@@ -596,16 +537,9 @@ // Check

gratipay.badgeCategory = 'funding';
/**
* Flattr Badge
* @method flattr
* @param {Object} opts
* @param {string} opts.flattrCode The Flattr code to donate to (e.g. 344188/balupton-on-Flattr)
* @param {string} opts.flattrUsername The Flattr username to donate to (e.g. balupton)
* @param {string} opts.flattrURL The url to the flattr donate page
* @return {string} the result badge
*/
/** At least one of the properties must be provided */
function flattr(_ref20) {
var flattrCode = _ref20.flattrCode,
flattrUsername = _ref20.flattrUsername,
flattrURL = _ref20.flattrURL;
/** Flattr Badge */
function flattr(_ref21) {
var flattrCode = _ref21.flattrCode,
flattrUsername = _ref21.flattrUsername,
flattrURL = _ref21.flattrURL;

@@ -637,16 +571,9 @@ // Check

flattr.badgeCategory = 'funding';
/**
* Paypal Badge
* @method paypal
* @param {Object} opts
* @param {string} opts.paypalURL The url to the paypal donate page
* @param {string} opts.paypalButtonID The Paypal button id
* @param {string} opts.paypalUsername The Paypal.me username
* @return {string} the result badge
*/
/** At least one of the properties must be provided */
function paypal(_ref21) {
var paypalURL = _ref21.paypalURL,
paypalButtonID = _ref21.paypalButtonID,
paypalUsername = _ref21.paypalUsername;
/** Paypal Badge */
function paypal(_ref22) {
var paypalURL = _ref22.paypalURL,
paypalButtonID = _ref22.paypalButtonID,
paypalUsername = _ref22.paypalUsername;

@@ -678,13 +605,7 @@ // Check

paypal.badgeCategory = 'funding';
/**
* Crypto Badge
* @method crypto
* @param {Object} opts
* @param {string} opts.cryptoURL The url to the crypto donation page
* @return {string} the result badge
*/
function crypto(_ref22) {
var cryptoURL = _ref22.cryptoURL,
bitcoinURL = _ref22.bitcoinURL;
/** Crypto Badge */
function crypto(_ref23) {
var cryptoURL = _ref23.cryptoURL,
bitcoinURL = _ref23.bitcoinURL;
// Check

@@ -706,8 +627,3 @@ var url = cryptoURL || bitcoinURL;

crypto.badgeCategory = 'funding';
/**
* Crypto Badge
* @method bitcoin
* @param {Object} opts - forwarded to {@link crypto}
* @return {string} the result badge
*/
/** @deprecated */

@@ -719,12 +635,6 @@ function bitcoin(opts) {

bitcoin.badgeCategory = 'funding';
/**
* Wishlist Badge
* @method wishlist
* @param {Object} opts
* @param {string} opts.wishlistURL The url to the wishlist page
* @return {string} the result badge
*/
function wishlist(_ref23) {
var wishlistURL = _ref23.wishlistURL;
/** Wishlist Badge */
function wishlist(_ref24) {
var wishlistURL = _ref24.wishlistURL;
// Check

@@ -746,14 +656,8 @@ if (!wishlistURL) throw new Error('wishlistURL is missing'); // Create

wishlist.badgeCategory = 'funding';
/**
* Buy Me A Coffee Badge
* @method buymeacoffee
* @param {Object} opts
* @param {string} opts.buymeacoffeeUsername The Buy Me A Coffee username to donate to
* @param {string} opts.buymeacoffeeURL The url to the Buy Me A Coffee donate page
* @return {string} the result badge
*/
/** At least one of the properties must be provided */
function buymeacoffee(_ref24) {
var buymeacoffeeUsername = _ref24.buymeacoffeeUsername,
buymeacoffeeURL = _ref24.buymeacoffeeURL;
/** Buy Me A Coffee Badge */
function buymeacoffee(_ref25) {
var buymeacoffeeUsername = _ref25.buymeacoffeeUsername,
buymeacoffeeURL = _ref25.buymeacoffeeURL;

@@ -780,14 +684,8 @@ // Check

buymeacoffee.badgeCategory = 'funding';
/**
* Liberapay Badge
* @method liberapay
* @param {Object} opts
* @param {string} opts.liberapayUsername The Liberapay username to donate to
* @param {string} opts.liberapayURL The url to the Liberapay donate page
* @return {string} the result badge
*/
/** At least one of the properties must be provided */
function liberapay(_ref25) {
var liberapayUsername = _ref25.liberapayUsername,
liberapayURL = _ref25.liberapayURL;
/** Liberapay Badge */
function liberapay(_ref26) {
var liberapayUsername = _ref26.liberapayUsername,
liberapayURL = _ref26.liberapayURL;

@@ -814,18 +712,10 @@ // Check

liberapay.badgeCategory = 'funding';
/**
* Thanks App Badge
* @method thanksapp
* @param {Object} opts
* @param {string} opts.npmPackageName The repository slug (username/reponame)
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @param {string} opts.thanksappUsername The username for the Thanks App donate page
* @param {string} opts.thanksappURL The url to the Thanks App donate page
* @return {string} the result badge
*/
/** At least one of the properties must be provided */
function thanksapp(_ref26) {
var npmPackageName = _ref26.npmPackageName,
githubSlug = _ref26.githubSlug,
thanksappUsername = _ref26.thanksappUsername,
thanksappURL = _ref26.thanksappURL;
/** Thanks App Badge */
function thanksapp(_ref27) {
var npmPackageName = _ref27.npmPackageName,
githubSlug = _ref27.githubSlug,
thanksappUsername = _ref27.thanksappUsername,
thanksappURL = _ref27.thanksappURL;

@@ -835,3 +725,3 @@ // Check

if (thanksappUsername) {
thanksappURL = "https://givethanks.app/u/".concat(githubSlug);
thanksappURL = "https://givethanks.app/u/".concat(thanksappUsername);
} else if (npmPackageName) {

@@ -860,12 +750,6 @@ thanksappURL = "https://givethanks.app/donate/npm/".concat(npmPackageName);

thanksapp.badgeCategory = 'funding';
/**
* Boost Lab Badge
* @method boostlab
* @param {Object} opts
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @return {string} the result badge
*/
/** Boost Lab Badge */
function boostlab(_ref27) {
var githubSlug = _ref27.githubSlug;
function boostlab(_ref28) {
var githubSlug = _ref28.githubSlug;
// Check

@@ -889,12 +773,5 @@ if (!githubSlug) throw new Error('githubSlug is missing'); // Create

/**
* Slackin Script Badge
* @method slackinscript
* @param {Object} opts
* @param {string} opts.slackinURL The slackin url (e.g. https://slack.bevry.me)
* @return {string} the result badge
*/
function slackinscript(_ref28) {
var slackinURL = _ref28.slackinURL;
/** Slackin Script Badge */
function slackinscript(_ref29) {
var slackinURL = _ref29.slackinURL;
// Check

@@ -908,12 +785,6 @@ if (!slackinURL) throw new Error('slackinURL is missing'); // Create

slackinscript.badgeScript = true;
/**
* Slackin Badge
* @method slackin
* @param {Object} opts
* @param {string} opts.slackinURL The slackin url (e.g. https://slack.bevry.me)
* @return {string} the result badge
*/
/** Slackin Badge */
function slackin(_ref29) {
var slackinURL = _ref29.slackinURL;
function slackin(_ref30) {
var slackinURL = _ref30.slackinURL;
// Check

@@ -935,15 +806,10 @@ if (!slackinURL) throw new Error('slackinURL is missing'); // Create

slackin.badgeCategory = 'social';
/**
* Google Analytics Beacon Badge
https://github.com/igrigorik/ga-beacon
* @method gabeacon
@param {Object} opts
* @param {string} opts.gaTrackingID The google analytics tracing id (e.g. UA-XXXXX-XX)
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @return {string} the result badge
* https://github.com/igrigorik/ga-beacon
*/
function gabeacon(_ref30) {
var gaTrackingID = _ref30.gaTrackingID,
githubSlug = _ref30.githubSlug;
function gabeacon(_ref31) {
var gaTrackingID = _ref31.gaTrackingID,
githubSlug = _ref31.githubSlug;
// Check

@@ -966,12 +832,6 @@ if (!gaTrackingID) throw new Error('gaTrackingID is missing');

gabeacon.badgeCategory = 'social';
/**
* Google Plus One Button
* @method googleplusone
* @param {Object} opts
* @param {string} opts.homepage The page url that the badge will be for
* @return {string} the result badge
*/
/** Google Plus One Button */
function googleplusone(_ref31) {
var homepage = _ref31.homepage;
function googleplusone(_ref32) {
var homepage = _ref32.homepage;
// Check

@@ -985,12 +845,6 @@ if (!homepage) throw new Error('homepage is missing'); // Create

googleplusone.badgeScript = true;
/**
* Reddit Submit Button
* @method redditsubmit
* @param {Object} opts
* @param {string} opts.homepage The page url that the badge will be for
* @return {string} the result badge
*/
/** Reddit Submit Button */
function redditsubmit(_ref32) {
var homepage = _ref32.homepage;
function redditsubmit(_ref33) {
var homepage = _ref33.homepage;
// Check

@@ -1004,12 +858,6 @@ if (!homepage) throw new Error('homepage is missing'); // Create

redditsubmit.badgeScript = true;
/**
* Hacker News Submit Button
* @method hackernewssubmit
* @param {Object} opts
* @param {string} opts.homepage The page url that the badge will be for
* @return {string} the result badge
*/
/** Hacker News Submit Button */
function hackernewssubmit(_ref33) {
var homepage = _ref33.homepage;
function hackernewssubmit(_ref34) {
var homepage = _ref34.homepage;
// Check

@@ -1023,14 +871,7 @@ if (!homepage) throw new Error('homepage is missing'); // Create

hackernewssubmit.badgeScript = true;
/**
* Facebook Like Button
* @method facebooklike
* @param {Object} opts
* @param {string} opts.homepage The page url that the badge will be for
* @param {string} opts.facebookApplicationID The facebook application id that the badge is for
* @return {string} the result badge
*/
function facebooklike(_ref34) {
var homepage = _ref34.homepage,
facebookApplicationID = _ref34.facebookApplicationID;
/** Facebook Like Button */
function facebooklike(_ref35) {
var homepage = _ref35.homepage,
facebookApplicationID = _ref35.facebookApplicationID;
// Prepare

@@ -1046,14 +887,7 @@ if (!homepage) throw new Error('homepage is missing');

facebooklike.badgeScript = true;
/**
* Facebook Follow Button
* @method facebookfollow
* @param {Object} opts
* @param {string} opts.facebookUsername The facebook username to follow
* @param {string} opts.facebookApplicationID The facebook application id that the badge is for
* @return {string} the result badge
*/
function facebookfollow(_ref35) {
var facebookUsername = _ref35.facebookUsername,
facebookApplicationID = _ref35.facebookApplicationID;
/** Facebook Follow Button */
function facebookfollow(_ref36) {
var facebookUsername = _ref36.facebookUsername,
facebookApplicationID = _ref36.facebookApplicationID;
// Prepare

@@ -1069,12 +903,6 @@ if (!facebookUsername) throw new Error('facebookUsername is missing');

facebookfollow.badgeScript = true;
/**
* Twitter Tweet Button
* @method twittertweet
* @param {Object} opts
* @param {string} opts.twitterUsername The twitter username to tweet at
* @return {string} the result badge
*/
/** Twitter Tweet Button */
function twittertweet(_ref36) {
var twitterUsername = _ref36.twitterUsername;
function twittertweet(_ref37) {
var twitterUsername = _ref37.twitterUsername;
// Prepare

@@ -1088,12 +916,6 @@ if (!twitterUsername) throw new Error('twitterUsername is missing'); // Return

twittertweet.badgeScript = true;
/**
* Twitter Follow Button
* @method twitterfollow
* @param {Object} opts
* @param {string} opts.twitterUsername The twitter username to follow
* @return {string} the result badge
*/
/** Twitter Follow Button */
function twitterfollow(_ref37) {
var twitterUsername = _ref37.twitterUsername;
function twitterfollow(_ref38) {
var twitterUsername = _ref38.twitterUsername;
// Prepare

@@ -1107,12 +929,6 @@ if (!twitterUsername) throw new Error('twitterUsername is missing'); // Return

twitterfollow.badgeScript = true;
/**
* Github Follow Button
* @method githubfollow
* @param {Object} opts
* @param {string} opts.githubUsername The github user to follow
* @return {string} the result badge
*/
/** Github Follow Button */
function githubfollow(_ref38) {
var githubUsername = _ref38.githubUsername;
function githubfollow(_ref39) {
var githubUsername = _ref39.githubUsername;
// Prepare

@@ -1126,12 +942,6 @@ if (!githubUsername) throw new Error('githubUsername is missing'); // Return

githubfollow.badgeScript = true;
/**
* GitHub Star Button
* @method githubstar
* @param {Object} opts
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges)
* @return {string} the result badge
*/
/** GitHub Star Button */
function githubstar(_ref39) {
var githubSlug = _ref39.githubSlug;
function githubstar(_ref40) {
var githubSlug = _ref40.githubSlug;
// Prepare

@@ -1149,16 +959,8 @@ if (!githubSlug) throw new Error('githubSlug is missing');

githubstar.badgeScript = true;
/**
* Quora Follow Button
* @method quorafollow
* @param {Object} opts
* @param {string} opts.quoraUsername The quora user to follow
* @param {string} [opts.quoraRealname] The quora user's name
* @param {string} [opts.quoraCode] Some code
* @return {string} the result badge
*/
function quorafollow(_ref40) {
var quoraUsername = _ref40.quoraUsername,
quoraRealname = _ref40.quoraRealname,
quoraCode = _ref40.quoraCode;
/** Quora Follow Button */
function quorafollow(_ref41) {
var quoraUsername = _ref41.quoraUsername,
quoraRealname = _ref41.quoraRealname,
quoraCode = _ref41.quoraCode;
// Prepare

@@ -1173,46 +975,2 @@ if (!quoraUsername) throw new Error('quoraUsername is missing');

quorafollow.badgeCategory = 'social';
quorafollow.badgeScript = true; // Export
module.exports = {
badge: badge,
shields: shields,
npmversion: npmversion,
npmdownloads: npmdownloads,
daviddm: daviddm,
daviddmdev: daviddmdev,
saucelabsbm: saucelabsbm,
saucelabs: saucelabs,
travisci: travisci,
codeship: codeship,
coveralls: coveralls,
codeclimate: codeclimate,
bithound: bithound,
waffle: waffle,
sixtydevstips: sixtydevstips,
patreon: patreon,
opencollective: opencollective,
gratipay: gratipay,
flattr: flattr,
paypal: paypal,
crypto: crypto,
bitcoin: bitcoin,
wishlist: wishlist,
buymeacoffee: buymeacoffee,
liberapay: liberapay,
thanksapp: thanksapp,
boostlab: boostlab,
slackinscript: slackinscript,
slackin: slackin,
gabeacon: gabeacon,
googleplusone: googleplusone,
redditsubmit: redditsubmit,
hackernewssubmit: hackernewssubmit,
facebooklike: facebooklike,
facebookfollow: facebookfollow,
twittertweet: twittertweet,
twitterfollow: twitterfollow,
githubfollow: githubfollow,
githubstar: githubstar,
quorafollow: quorafollow,
nodeico: nodeico
};
quorafollow.badgeScript = true;

@@ -1,13 +0,29 @@

'use strict'; // Import
"use strict";
var badges = require('./badges');
/**
Render a specified badge with the appropriate wrapping (div if block badge, span if inline badge)
@method renderBadge
@param {String} badgeName The name of the badge to render
@param {Object} config The configuration to pass to the badge render method
@return {String} The rendered badge
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.renderBadge = renderBadge;
exports.renderBadges = renderBadges;
exports.badges = void 0;
var badges = _interopRequireWildcard(require("./badges.js"));
exports.badges = badges;
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
// Import
/**
* Render a specified badge with the appropriate wrapping (div if block badge, span if inline badge)
* @method renderBadge
* @param badgeName The name of the badge to render
* @param config The configuration to pass to the badge render method
* @return The rendered badge
*/
function renderBadge(badgeName) {

@@ -19,2 +35,3 @@ var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

} // Fetch
// @ts-ignore

@@ -32,12 +49,10 @@

}
/**
Render specified badges with wrapping
@method renderBadges
@param {Array} list The list of badge names to render
@param {Object} config The configuration to render the badge with
@param {Object} options An object that defaults to `{filterCategory: false, filterScripts: false}`
@return {String} The rendered badges
*/
* Render specified badges with wrapping
* @param list The list of badge names to render
* @param config The configuration to render the badge with
* @param options An object that defaults to `{filterCategory: false, filterScripts: false}`
* @return The rendered badges
*/
function renderBadges(list) {

@@ -65,13 +80,18 @@ var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

} // Exists?
else if (badges[badgeName]) {
// Category?
if (options.filterCategory && options.filterCategory !== badges[badgeName].badgeCategory) return; // Script?
else {
// @ts-ignore
var badge = badges[badgeName];
if (options.filterScripts && badges[badgeName].badgeScript) return;
} // Doesn't exist
else {
throw new Error("the badge ".concat(badgeName, " does not exist"));
} // Render
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 ".concat(badgeName, " does not exist"));
}
} // Render
var badgeResult = renderBadge(badgeName, badgeConfig).trim();

@@ -84,9 +104,2 @@ if (!badgeResult) return; // Rendered successfully, add the result

return results.join('\n');
} // Export
module.exports = {
badges: badges,
renderBadge: renderBadge,
renderBadges: renderBadges
};
}
# History
## v3.0.0 2019 December 6
- Converted to TypeScript
- Fixed `thanksapp` badge not respecting `thanksappUsername`
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
## v2.3.0 2019 December 1

@@ -4,0 +10,0 @@

{
"name": "badges",
"version": "2.3.0",
"version": "3.0.0-next.1575629350.eaa08ac98c4f4b0013f581e424438f7061e96e56",
"description": "The definitive collection of badges for rendering",

@@ -56,2 +56,3 @@ "homepage": "https://github.com/bevry/badges",

"github",
"github sponsors",
"github follow",

@@ -125,18 +126,27 @@ "github star",

{
"description": "esnext source code with require for modules",
"description": "typescript source code with import for modules",
"directory": "source",
"entry": "index.ts",
"tags": [
"typescript",
"import"
],
"engines": false
},
{
"description": "typescript compiled for browsers with import for modules",
"directory": "edition-browsers",
"entry": "index.js",
"tags": [
"javascript",
"esnext",
"require"
"import"
],
"engines": {
"node": "8 || 10 || 12",
"browsers": false
"node": false,
"browsers": "defaults"
}
},
{
"description": "esnext compiled for browsers with require for modules",
"directory": "edition-browsers",
"description": "typescript compiled for node.js 12 with require for modules",
"directory": "edition-node-12",
"entry": "index.js",

@@ -148,35 +158,45 @@ "tags": [

"engines": {
"node": false,
"browsers": "defaults"
"node": "8 || 10 || 12",
"browsers": false
}
}
],
"main": "source/index.js",
"types": "source/index.ts",
"type": "commonjs",
"main": "edition-node-12/index.js",
"browser": "edition-browsers/index.js",
"module": "edition-browsers/index.js",
"devDependencies": {
"@babel/cli": "^7.7.4",
"@babel/core": "^7.7.4",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-proposal-object-rest-spread": "^7.7.4",
"@babel/plugin-proposal-optional-chaining": "^7.7.4",
"@babel/preset-env": "^7.7.4",
"@babel/preset-typescript": "^7.7.4",
"@typescript-eslint/eslint-plugin": "^2.10.0",
"@typescript-eslint/parser": "^2.10.0",
"assert-helpers": "^5.7.0",
"babel-plugin-add-module-exports": "^1.0.2",
"eslint": "^6.7.2",
"eslint-config-bevry": "^2.1.0",
"eslint-config-bevry": "^2.2.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-prettier": "^3.1.1",
"jsdoc": "^3.6.3",
"kava": "^4.2.0",
"minami": "^1.2.3",
"kava": "^4.3.0",
"prettier": "^1.19.1",
"projectz": "^1.13.0",
"projectz": "^1.14.0",
"surge": "^0.21.3",
"valid-directory": "^1.4.0"
"typedoc": "^0.15.3",
"typescript": "^3.7.3",
"valid-directory": "^1.5.0"
},
"scripts": {
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next",
"our:compile": "npm run our:compile:edition-browsers",
"our:compile:edition-browsers": "env BABEL_ENV=edition-browsers babel --out-dir ./edition-browsers ./source",
"our:compile": "npm run our:compile:edition-browsers && npm run our:compile:edition-node-12",
"our:compile:edition-browsers": "env BABEL_ENV=edition-browsers babel --extensions \".ts,.tsx\" --out-dir ./edition-browsers ./source",
"our:compile:edition-node-12": "env BABEL_ENV=edition-node-12 babel --extensions \".ts,.tsx\" --out-dir ./edition-node-12 ./source",
"our:deploy": "echo no need for this project",
"our:meta": "npm run our:meta:docs && npm run our:meta:projectz",
"our:meta:docs": "npm run our:meta:docs:jsdoc",
"our:meta:docs:jsdoc": "rm -Rf ./docs && jsdoc --recurse --pedantic --access all --destination ./docs --package ./package.json --readme ./README.md --template ./node_modules/minami ./source && mv ./docs/$npm_package_name/$npm_package_version/* ./docs/ && rm -Rf ./docs/$npm_package_name/$npm_package_version",
"our:meta:docs": "npm run our:meta:docs:typedoc",
"our:meta:docs:typedoc": "rm -Rf ./docs && typedoc --mode file --exclude '**/+(*test*|node_modules)' --excludeExternals --name \"$npm_package_name\" --readme ./README.md --out ./docs ./source",
"our:meta:projectz": "projectz compile",

@@ -192,7 +212,8 @@ "our:release": "npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push",

"our:test": "npm run our:verify && npm test",
"our:verify": "npm run our:verify:directory && npm run our:verify:eslint && npm run our:verify:prettier",
"our:verify": "npm run our:verify:directory && npm run our:verify:eslint && npm run our:verify:prettier && npm run our:verify:typescript",
"our:verify:directory": "npx valid-directory",
"our:verify:eslint": "eslint --fix --ignore-pattern '**/*.d.ts' --ignore-pattern '**/vendor/' --ignore-pattern '**/node_modules/' --ext .mjs,.js,.jsx,.ts,.tsx ./source",
"our:verify:prettier": "prettier --write ./source/**",
"test": "node ./source/test.js"
"our:verify:typescript": "tsc --noEmit --project tsconfig.json",
"test": "node ./edition-node-12/test.js"
},

@@ -211,3 +232,3 @@ "eslintConfig": {

"edition-browsers": {
"sourceType": "script",
"sourceType": "module",
"presets": [

@@ -220,7 +241,32 @@ [

}
]
],
"@babel/preset-typescript"
],
"plugins": [
"@babel/proposal-object-rest-spread"
"@babel/proposal-object-rest-spread",
"@babel/plugin-proposal-optional-chaining",
"@babel/proposal-class-properties",
"add-module-exports"
]
},
"edition-node-12": {
"sourceType": "module",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "12"
},
"modules": "commonjs"
}
],
"@babel/preset-typescript"
],
"plugins": [
"@babel/proposal-object-rest-spread",
"@babel/plugin-proposal-optional-chaining",
"@babel/proposal-class-properties",
"add-module-exports"
]
}

@@ -227,0 +273,0 @@ }

@@ -57,18 +57,7 @@ <!-- TITLE/ -->

<ul><li><code>badges</code> aliases <code>badges/source/index.js</code></li>
<li><code>badges/source/index.js</code> is esnext source code with require for modules</li>
<li><code>badges/edition-browsers/index.js</code> is esnext compiled for browsers with require for modules</li></ul>
<ul><li><code>badges/source/index.ts</code> is typescript source code with import for modules</li>
<li><code>badges/edition-browsers/index.js</code> is typescript compiled for browsers with import for modules</li>
<li><code>badges</code> aliases <code>badges/edition-node-12/index.js</code></li>
<li><code>badges/edition-node-12/index.js</code> is typescript compiled for node.js 12 with require for modules</li></ul>
<h3><a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a></h3>
This project provides its type information via inline <a href="http://usejsdoc.org" title="JSDoc is an API documentation generator for JavaScript, similar to Javadoc or phpDocumentor">JSDoc Comments</a>. To make use of this in <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a>, set your <code>maxNodeModuleJsDepth</code> compiler option to `5` or thereabouts. You can accomlish this via your `tsconfig.json` file like so:
``` json
{
"compilerOptions": {
"maxNodeModuleJsDepth": 5
}
}
```
<!-- /INSTALL -->

@@ -79,52 +68,65 @@

``` javascript
```javascript
// Listing of badges to output
const list = [
// Custom Badges
['badge', {image: 'image', alt: 'alt'}],
['badge', {image: 'image', alt: 'alt', url: 'url', title: 'title'}],
['shields', {left: 'left', right: 'right', alt: 'alt', url: 'url', title: 'title'}],
['shields', {left: 'left', right: 'right', color: 'red', alt: 'alt', url: 'url', title: 'title'}],
'---',
// Development Badges
'npmversion',
'npmdownloads',
'daviddm',
'daviddmdev',
'nodeico',
'---',
// Testing Badges
'saucelabsbm',
'saucelabs',
'travisci',
'codeship',
'coveralls',
'codeclimate',
'bithound',
'waffle',
'---',
// Funding Badges
'sixtydevstips',
'patreon',
'opencollective',
'gratipay',
'flattr',
'paypal',
'bitcoin',
'wishlist',
'---',
// Social Badges
'slackinscript',
'slackin',
'gabeacon',
'googleplusone',
'redditsubmit',
'hackernewssubmit',
'facebooklike',
'facebookfollow',
'twittertweet',
'twitterfollow',
'githubfollow',
'githubstar',
'quorafollow'
// Custom Badges
['badge', { image: 'image', alt: 'alt' }],
['badge', { image: 'image', alt: 'alt', url: 'url', title: 'title' }],
[
'shields',
{ left: 'left', right: 'right', alt: 'alt', url: 'url', title: 'title' }
],
[
'shields',
{
left: 'left',
right: 'right',
color: 'red',
alt: 'alt',
url: 'url',
title: 'title'
}
],
'---',
// Development Badges
'npmversion',
'npmdownloads',
'daviddm',
'daviddmdev',
'nodeico',
'---',
// Testing Badges
'saucelabsbm',
'saucelabs',
'travisci',
'codeship',
'coveralls',
'codeclimate',
'bithound',
'waffle',
'---',
// Funding Badges
'sixtydevstips',
'patreon',
'opencollective',
'gratipay',
'flattr',
'paypal',
'bitcoin',
'wishlist',
'---',
// Social Badges
'slackinscript',
'slackin',
'gabeacon',
'googleplusone',
'redditsubmit',
'hackernewssubmit',
'facebooklike',
'facebookfollow',
'twittertweet',
'twitterfollow',
'githubfollow',
'githubstar',
'quorafollow'
]

@@ -134,31 +136,31 @@

const config = {
npmPackageName: 'badges',
npmPackageName: 'badges',
saucelabsUsername: 'bevry',
saucelabsAuthToken: '123',
codeshipProjectUUID: '123',
codeshipProjectID: '123',
githubSlug: 'bevry/badges',
nodeicoQueryString: {downloads: true, compact: true, height: 2},
saucelabsUsername: 'bevry',
saucelabsAuthToken: '123',
codeshipProjectUUID: '123',
codeshipProjectID: '123',
githubSlug: 'bevry/badges',
nodeicoQueryString: { downloads: true, compact: true, height: 2 },
sixtydevstipsID: 'd2dcf439c9759e88f3ccec1cef394c10',
patreonUsername: 'bevry',
opencollectiveUsername: 'bevry',
gratipayUsername: 'bevry',
flattrUsername: 'balupton',
paypalURL: 'https://paypal.me/bevry',
paypalButtonID: 'QB8GQPZAH84N6', // another option instead of paypalURL
paypalUsername: 'bevry', // another option instead of paypalURL
bitcoinURL: 'https://bevry.me/bitcoin',
wishlistURL: 'https://bevry.me/wishlist',
sixtydevstipsID: 'd2dcf439c9759e88f3ccec1cef394c10',
patreonUsername: 'bevry',
opencollectiveUsername: 'bevry',
gratipayUsername: 'bevry',
flattrUsername: 'balupton',
paypalURL: 'https://paypal.me/bevry',
paypalButtonID: 'QB8GQPZAH84N6', // another option instead of paypalURL
paypalUsername: 'bevry', // another option instead of paypalURL
bitcoinURL: 'https://bevry.me/bitcoin',
wishlistURL: 'https://bevry.me/wishlist',
slackinURL: 'https://slack.bevry.me',
gaTrackingID: 'UA-XXXXX-XX',
homepage: 'http://bevry.me',
facebookApplicationID: '123123',
facebookUsername: 'balupton',
twitterUsername: 'bevryme',
githubUsername: 'balupton',
quoraUsername: 'Benjamin-Lupton',
quoraRealname: 'Benjamin Arthur Lupton' // optional, will extract from username
slackinURL: 'https://slack.bevry.me',
gaTrackingID: 'UA-XXXXX-XX',
homepage: 'https://bevry.me',
facebookApplicationID: '123123',
facebookUsername: 'balupton',
twitterUsername: 'bevryme',
githubUsername: 'balupton',
quoraUsername: 'Benjamin-Lupton',
quoraRealname: 'Benjamin Arthur Lupton' // optional, will extract from username
}

@@ -168,11 +170,11 @@

const options = {
// Filter Category
// When set to a string, will only render badges from the list that of the specified category
// Values can be 'development', 'testing', 'funding', or 'social'
// E.g. to render only funding badges, set to 'funding'
filterCategory: false,
// Filter Category
// When set to a string, will only render badges from the list that of the specified category
// Values can be 'development', 'testing', 'funding', or 'social'
// E.g. to render only funding badges, set to 'funding'
filterCategory: false,
// Filter Scripts
// When true, do not render any badges from the list that are scripts
filterScripts: false
// Filter Scripts
// When true, do not render any badges from the list that are scripts
filterScripts: false
}

@@ -191,3 +193,2 @@

<!-- HISTORY/ -->

@@ -216,11 +217,10 @@

1. [Add the badge rendering code to the appropriate category section inside `source/badges.js`](https://github.com/bevry/badges/blob/master/source/badges.js)
1. If your badge requires a script to run, it should have `badgeScript = true` - see other badges for an example
2. [Also remember to export your badge](https://github.com/bevry/badges/blob/0b4aab710fc676f635e49e702960db0d151a12d5/source/badges.js#L667-L668)
2. [Add the badges test data to the test file `source/test.js`](https://github.com/bevry/badges/blob/master/source/test.js)
3. [Add the badge configuration information to this readme file `README.md`](https://github.com/bevry/badges/blob/master/README.md)
4. [Add the badge name to the `keyword` field of `package.json`](https://github.com/bevry/badges/blob/master/package.json)
1. If your badge requires a script to run, it should have `badgeScript = true` - see other badges for an example
1. [Also remember to export your badge](https://github.com/bevry/badges/blob/0b4aab710fc676f635e49e702960db0d151a12d5/source/badges.js#L667-L668)
1. [Add the badges test data to the test file `source/test.js`](https://github.com/bevry/badges/blob/master/source/test.js)
1. [Add the badge configuration information to this readme file `README.md`](https://github.com/bevry/badges/blob/master/README.md)
1. [Add the badge name to the `keyword` field of `package.json`](https://github.com/bevry/badges/blob/master/package.json)
These changes can be done in multiple commits or the same, it doesn't matter, as we will squash the commits on merge. We will also the changelog entry, so you don't need to do.
<!-- BACKERS/ -->

@@ -227,0 +227,0 @@

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