Comparing version 1.2.8 to 1.2.9
@@ -1,10 +0,6 @@ | ||
'use strict'; | ||
'use strict'; // Import | ||
// Import | ||
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); } | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var querystring = require('querystring'); | ||
// ==================================== | ||
var querystring = require('querystring'); // ==================================== | ||
// Custom Badges | ||
@@ -23,20 +19,22 @@ | ||
*/ | ||
function badge(_ref) { | ||
var image = _ref.image, | ||
alt = _ref.alt, | ||
url = _ref.url, | ||
title = _ref.title; | ||
var image = _ref.image, | ||
alt = _ref.alt, | ||
url = _ref.url, | ||
title = _ref.title; | ||
// Check | ||
if (!image) throw new Error('image is missing'); // Create | ||
// Check | ||
if (!image) throw new Error('image is missing'); | ||
var result = alt ? "<img src=\"".concat(image, "\" alt=\"").concat(alt, "\" />") : "<img src=\"".concat(image, "\" />"); | ||
// Create | ||
var 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; | ||
if (url) { | ||
result = (title ? "<a href=\"".concat(url, "\" title=\"").concat(title, "\">") : "<a href=\"".concat(url, "\">")) + result + '</a>'; | ||
} | ||
return result; | ||
} | ||
badge.badgeCategory = 'custom'; | ||
/** | ||
@@ -54,22 +52,25 @@ * Shields Custom Badge | ||
*/ | ||
function shields(_ref2) { | ||
var left = _ref2.left, | ||
right = _ref2.right, | ||
_ref2$color = _ref2.color, | ||
color = _ref2$color === undefined ? 'yellow' : _ref2$color, | ||
alt = _ref2.alt, | ||
url = _ref2.url, | ||
title = _ref2.title; | ||
var left = _ref2.left, | ||
right = _ref2.right, | ||
_ref2$color = _ref2.color, | ||
color = _ref2$color === void 0 ? 'yellow' : _ref2$color, | ||
alt = _ref2.alt, | ||
url = _ref2.url, | ||
title = _ref2.title; | ||
// Check | ||
if (!left) throw new Error('left is missing'); | ||
if (!right) throw new Error('right is missing'); // Create | ||
// Check | ||
if (!left) throw new Error('left is missing'); | ||
if (!right) throw new Error('right is missing'); | ||
// Create | ||
var image = 'https://img.shields.io/badge/' + left + '-' + right + '-' + color + '.svg'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = "https://img.shields.io/badge/".concat(left, "-").concat(right, "-").concat(color, ".svg"); | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
shields.badgeCategory = 'custom'; | ||
// ==================================== | ||
shields.badgeCategory = 'custom'; // ==================================== | ||
// Development Badges | ||
@@ -84,17 +85,21 @@ | ||
*/ | ||
function npmversion(_ref3) { | ||
var npmPackageName = _ref3.npmPackageName; | ||
var npmPackageName = _ref3.npmPackageName; | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); // Create | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
var image = "https://img.shields.io/npm/v/".concat(npmPackageName, ".svg"); | ||
var url = "https://npmjs.org/package/".concat(npmPackageName); | ||
var alt = 'NPM version'; | ||
var title = 'View this project on NPM'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/npm/v/' + npmPackageName + '.svg'; | ||
var url = 'https://npmjs.org/package/' + npmPackageName; | ||
var alt = 'NPM version'; | ||
var title = 'View this project on NPM'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
npmversion.badgeCategory = 'development'; | ||
/** | ||
@@ -107,16 +112,20 @@ * NPM Downloads Badge | ||
*/ | ||
function npmdownloads(_ref4) { | ||
var npmPackageName = _ref4.npmPackageName; | ||
var npmPackageName = _ref4.npmPackageName; | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
var image = "https://img.shields.io/npm/dm/".concat(npmPackageName, ".svg"); | ||
var url = "https://npmjs.org/package/".concat(npmPackageName); | ||
var alt = 'NPM downloads'; | ||
var title = 'View this project on NPM'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
var image = 'https://img.shields.io/npm/dm/' + npmPackageName + '.svg'; | ||
var url = 'https://npmjs.org/package/' + npmPackageName; | ||
var alt = 'NPM downloads'; | ||
var title = 'View this project on NPM'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
npmdownloads.badgeCategory = 'development'; | ||
/** | ||
@@ -129,17 +138,21 @@ * David DM Dependencies Badge | ||
*/ | ||
function daviddm(_ref5) { | ||
var githubSlug = _ref5.githubSlug; | ||
var githubSlug = _ref5.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://img.shields.io/david/".concat(githubSlug, ".svg"); | ||
var url = "https://david-dm.org/".concat(githubSlug); | ||
var alt = 'Dependency Status'; | ||
var title = "View the status of this project's dependencies on DavidDM"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/david/' + githubSlug + '.svg'; | ||
var url = 'https://david-dm.org/' + githubSlug; | ||
var alt = 'Dependency Status'; | ||
var title = "View the status of this project's dependencies on DavidDM"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
daviddm.badgeCategory = 'development'; | ||
/** | ||
@@ -152,17 +165,21 @@ * David DM Dev Dependencies Badge | ||
*/ | ||
function daviddmdev(_ref6) { | ||
var githubSlug = _ref6.githubSlug; | ||
var githubSlug = _ref6.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://img.shields.io/david/dev/".concat(githubSlug, ".svg"); | ||
var url = "https://david-dm.org/".concat(githubSlug, "#info=devDependencies"); | ||
var alt = 'Dev Dependency Status'; | ||
var title = "View the status of this project's development dependencies on DavidDM"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/david/dev/' + githubSlug + '.svg'; | ||
var url = 'https://david-dm.org/' + githubSlug + '#info=devDependencies'; | ||
var alt = 'Dev Dependency Status'; | ||
var title = "View the status of this project's development dependencies on DavidDM"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
daviddmdev.badgeCategory = 'development'; | ||
/** | ||
@@ -178,24 +195,29 @@ * Nodei.co Badge | ||
*/ | ||
function nodeico(_ref7) { | ||
var npmPackageName = _ref7.npmPackageName, | ||
nodeicoQueryString = _ref7.nodeicoQueryString; | ||
var npmPackageName = _ref7.npmPackageName, | ||
nodeicoQueryString = _ref7.nodeicoQueryString; | ||
// Prepare | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
// Prepare | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
if (nodeicoQueryString && typeof nodeicoQueryString !== 'string' && (typeof nodeicoQueryString === 'undefined' ? 'undefined' : _typeof(nodeicoQueryString)) !== 'object') { | ||
throw new Error('nodeicoQueryString must be a string or an object'); | ||
} | ||
if (nodeicoQueryString && typeof nodeicoQueryString !== 'string' && _typeof(nodeicoQueryString) !== 'object') { | ||
throw new Error('nodeicoQueryString must be a string or an object'); | ||
} // Return | ||
// Return | ||
var url = 'https://www.npmjs.com/package/' + npmPackageName; | ||
var alt = 'Nodei.co badge'; | ||
var title = 'Nodei.co badge'; | ||
var image = 'https://nodei.co/npm/' + npmPackageName + '.png'; | ||
var query = (typeof nodeicoQueryString === 'undefined' ? 'undefined' : _typeof(nodeicoQueryString)) === 'object' ? querystring.stringify(nodeicoQueryString) : nodeicoQueryString; | ||
if (query) image += '?' + query; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var url = "https://www.npmjs.com/package/".concat(npmPackageName); | ||
var alt = 'Nodei.co badge'; | ||
var title = 'Nodei.co badge'; | ||
var image = "https://nodei.co/npm/".concat(npmPackageName, ".png"); | ||
var query = _typeof(nodeicoQueryString) === 'object' ? querystring.stringify(nodeicoQueryString) : nodeicoQueryString; | ||
if (query) image += "?".concat(query); | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
nodeico.badgeCategory = 'development'; | ||
// ==================================== | ||
nodeico.badgeCategory = 'development'; // ==================================== | ||
// Testing Badges | ||
@@ -210,21 +232,25 @@ | ||
*/ | ||
function saucelabsbm(_ref8) { | ||
var saucelabsUsername = _ref8.saucelabsUsername, | ||
saucelabsAuthToken = _ref8.saucelabsAuthToken; | ||
var saucelabsUsername = _ref8.saucelabsUsername, | ||
saucelabsAuthToken = _ref8.saucelabsAuthToken; | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing'); | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN; | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing'); // Create | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing'); | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN; | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing'); | ||
var image = "https://saucelabs.com/browser-matrix/".concat(saucelabsUsername, ".svg?auth=").concat(escape(saucelabsAuthToken)); | ||
var url = "https://saucelabs.com/u/".concat(saucelabsUsername); | ||
var alt = 'Sauce Labs Browser Matrix'; | ||
var title = "Check this project's browser tests on Sauce Labs"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://saucelabs.com/browser-matrix/' + saucelabsUsername + '.svg?auth=' + escape(saucelabsAuthToken); | ||
var url = 'https://saucelabs.com/u/' + saucelabsUsername; | ||
var alt = 'Sauce Labs Browser Matrix'; | ||
var title = "Check this project's browser tests on Sauce Labs"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
saucelabsbm.badgeCategory = 'testing'; | ||
saucelabsbm.badgeInline = false; | ||
/** | ||
@@ -238,20 +264,24 @@ * Sauce Labs Badge | ||
*/ | ||
function saucelabs(_ref9) { | ||
var saucelabsUsername = _ref9.saucelabsUsername, | ||
saucelabsAuthToken = _ref9.saucelabsAuthToken; | ||
var saucelabsUsername = _ref9.saucelabsUsername, | ||
saucelabsAuthToken = _ref9.saucelabsAuthToken; | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing'); | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN; | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing'); // Create | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing'); | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN; | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing'); | ||
var image = "https://saucelabs.com/browser-matrix/".concat(saucelabsUsername, ".svg?auth=").concat(escape(saucelabsAuthToken)); | ||
var url = "https://saucelabs.com/u/".concat(saucelabsUsername); | ||
var alt = 'Sauce Labs Browser Matrix'; | ||
var title = "Check this project's browser tests on Sauce Labs"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://saucelabs.com/browser-matrix/' + saucelabsUsername + '.svg?auth=' + escape(saucelabsAuthToken); | ||
var url = 'https://saucelabs.com/u/' + saucelabsUsername; | ||
var alt = 'Sauce Labs Browser Matrix'; | ||
var title = "Check this project's browser tests on Sauce Labs"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
saucelabs.badgeCategory = 'testing'; | ||
/** | ||
@@ -262,19 +292,28 @@ * Travis CI Badge | ||
* @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 | ||
*/ | ||
function travisci(_ref10) { | ||
var githubSlug = _ref10.githubSlug; | ||
var githubSlug = _ref10.githubSlug, | ||
_ref10$travisTLD = _ref10.travisTLD, | ||
travisTLD = _ref10$travisTLD === void 0 ? 'org' : _ref10$travisTLD; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = ['https://img.shields.io/travis', travisTLD === 'com' ? 'com' : '', githubSlug, 'master.svg'].filter(function (i) { | ||
return Boolean(i); | ||
}).join('/'); | ||
var url = "http://travis-ci.".concat(travisTLD, "/").concat(githubSlug); | ||
var alt = 'Travis CI Build Status'; | ||
var title = "Check this project's build status on TravisCI"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/travis/' + githubSlug + '/master.svg'; | ||
var url = 'http://travis-ci.org/' + githubSlug; | ||
var alt = 'Travis CI Build Status'; | ||
var title = "Check this project's build status on TravisCI"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
travisci.badgeCategory = 'testing'; | ||
/** | ||
@@ -288,19 +327,23 @@ * Codeship Badge | ||
*/ | ||
function codeship(_ref11) { | ||
var codeshipProjectUUID = _ref11.codeshipProjectUUID, | ||
codeshipProjectID = _ref11.codeshipProjectID; | ||
var codeshipProjectUUID = _ref11.codeshipProjectUUID, | ||
codeshipProjectID = _ref11.codeshipProjectID; | ||
// Check | ||
if (!codeshipProjectUUID) throw new Error('codeshipProjectUUID is missing'); | ||
if (!codeshipProjectID) throw new Error('codeshipProjectID is missing'); // Create | ||
// Check | ||
if (!codeshipProjectUUID) throw new Error('codeshipProjectUUID is missing'); | ||
if (!codeshipProjectID) throw new Error('codeshipProjectID is missing'); | ||
var image = "https://img.shields.io/codeship/".concat(codeshipProjectUUID, "/master.svg"); | ||
var url = "https://www.codeship.io/projects/".concat(codeshipProjectID); | ||
var alt = 'Codeship Status'; | ||
var title = "Check this project's status on Codeship"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/codeship/' + codeshipProjectUUID + '/master.svg'; | ||
var url = 'https://www.codeship.io/projects/' + codeshipProjectID; | ||
var alt = 'Codeship Status'; | ||
var title = "Check this project's status on Codeship"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
codeship.badgeCategory = 'testing'; | ||
/** | ||
@@ -313,17 +356,21 @@ * Coveralls Badge | ||
*/ | ||
function coveralls(_ref12) { | ||
var githubSlug = _ref12.githubSlug; | ||
var githubSlug = _ref12.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://img.shields.io/coveralls/".concat(githubSlug, ".svg"); | ||
var url = "https://coveralls.io/r/".concat(githubSlug); | ||
var alt = 'Coveralls Coverage Status'; | ||
var title = "View this project's coverage on Coveralls"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/coveralls/' + githubSlug + '.svg'; | ||
var url = 'https://coveralls.io/r/' + githubSlug; | ||
var alt = 'Coveralls Coverage Status'; | ||
var title = "View this project's coverage on Coveralls"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
coveralls.badgeCategory = 'testing'; | ||
/** | ||
@@ -336,17 +383,21 @@ * Code Climate Rating Badge | ||
*/ | ||
function codeclimate(_ref13) { | ||
var githubSlug = _ref13.githubSlug; | ||
var githubSlug = _ref13.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://img.shields.io/codeclimate/github/".concat(githubSlug, ".svg"); | ||
var url = "https://codeclimate.com/github/".concat(githubSlug); | ||
var alt = 'Code Climate Rating'; | ||
var title = "View this project's rating on Code Climate"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/codeclimate/github/' + githubSlug + '.svg'; | ||
var url = 'https://codeclimate.com/github/' + githubSlug; | ||
var alt = 'Code Climate Rating'; | ||
var title = "View this project's rating on Code Climate"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
codeclimate.badgeCategory = 'testing'; | ||
/** | ||
@@ -359,17 +410,21 @@ * BitHound Score Badge | ||
*/ | ||
function bithound(_ref14) { | ||
var githubSlug = _ref14.githubSlug; | ||
var githubSlug = _ref14.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://bithound.io/github/".concat(githubSlug, "/badges/score.svg"); | ||
var url = "https://bithound.io/github/".concat(githubSlug); | ||
var alt = 'BitHound Score'; | ||
var title = "View this project's score on BitHound"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://bithound.io/github/' + githubSlug + '/badges/score.svg'; | ||
var url = 'https://bithound.io/github/' + githubSlug; | ||
var alt = 'BitHound Score'; | ||
var title = "View this project's score on BitHound"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
bithound.badgeCategory = 'testing'; | ||
/** | ||
@@ -382,19 +437,22 @@ * Waffle Badge | ||
*/ | ||
function waffle(_ref15) { | ||
var githubSlug = _ref15.githubSlug; | ||
var githubSlug = _ref15.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
// Create | ||
var label = 'ready'; | ||
var image = 'https://badge.waffle.io/' + githubSlug + '.png?label=' + escape(label); | ||
var url = 'http://waffle.io/' + githubSlug; | ||
var alt = 'Stories in Ready'; | ||
var title = "View this project's stories on Waffle.io"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var label = 'ready'; | ||
var image = "https://badge.waffle.io/".concat(githubSlug, ".png?label=").concat(escape(label)); | ||
var url = "http://waffle.io/".concat(githubSlug); | ||
var alt = 'Stories in Ready'; | ||
var title = "View this project's stories on Waffle.io"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
waffle.badgeCategory = 'testing'; | ||
// ==================================== | ||
waffle.badgeCategory = 'testing'; // ==================================== | ||
// Funding Badges | ||
@@ -410,21 +468,27 @@ | ||
*/ | ||
function sixtydevstips(_ref16) { | ||
var sixtydevstipsID = _ref16.sixtydevstipsID, | ||
sixtydevstipsURL = _ref16.sixtydevstipsURL; | ||
var sixtydevstipsID = _ref16.sixtydevstipsID, | ||
sixtydevstipsURL = _ref16.sixtydevstipsURL; | ||
// Check | ||
if (!sixtydevstipsURL) { | ||
if (!sixtydevstipsID) throw new Error('sixtydevstipsID is missing'); | ||
sixtydevstipsURL = 'https://tips.60devs.com/tip/' + sixtydevstipsID; | ||
} | ||
// Check | ||
if (!sixtydevstipsURL) { | ||
if (!sixtydevstipsID) throw new Error('sixtydevstipsID is missing'); | ||
sixtydevstipsURL = "https://tips.60devs.com/tip/".concat(sixtydevstipsID); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/60devs-donate-yellow.svg'; | ||
var url = sixtydevstipsURL; | ||
var alt = '60devs tips donate button'; | ||
var title = 'Donate to this project using 60devs tips'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/60devs-donate-yellow.svg'; | ||
var url = sixtydevstipsURL; | ||
var alt = '60devs tips donate button'; | ||
var title = 'Donate to this project using 60devs tips'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
sixtydevstips.badgeCategory = 'funding'; | ||
/** | ||
@@ -438,21 +502,27 @@ * Patreon Badge | ||
*/ | ||
function patreon(_ref17) { | ||
var patreonUsername = _ref17.patreonUsername, | ||
patreonURL = _ref17.patreonURL; | ||
var patreonUsername = _ref17.patreonUsername, | ||
patreonURL = _ref17.patreonURL; | ||
// Check | ||
if (!patreonURL) { | ||
if (!patreonUsername) throw new Error('patreonUsername is missing'); | ||
patreonURL = 'https://patreon.com/' + patreonUsername; | ||
} | ||
// Check | ||
if (!patreonURL) { | ||
if (!patreonUsername) throw new Error('patreonUsername is missing'); | ||
patreonURL = "https://patreon.com/".concat(patreonUsername); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/patreon-donate-yellow.svg'; | ||
var url = patreonURL; | ||
var alt = 'Patreon donate button'; | ||
var title = 'Donate to this project using Patreon'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/patreon-donate-yellow.svg'; | ||
var url = patreonURL; | ||
var alt = 'Patreon donate button'; | ||
var title = 'Donate to this project using Patreon'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
patreon.badgeCategory = 'funding'; | ||
/** | ||
@@ -466,21 +536,27 @@ * Open Collective Badge | ||
*/ | ||
function opencollective(_ref18) { | ||
var opencollectiveUsername = _ref18.opencollectiveUsername, | ||
opencollectiveURL = _ref18.opencollectiveURL; | ||
var opencollectiveUsername = _ref18.opencollectiveUsername, | ||
opencollectiveURL = _ref18.opencollectiveURL; | ||
// Check | ||
if (!opencollectiveURL) { | ||
if (!opencollectiveUsername) throw new Error('opencollectiveUsername is missing'); | ||
opencollectiveURL = 'https://opencollective.com/' + opencollectiveUsername; | ||
} | ||
// Check | ||
if (!opencollectiveURL) { | ||
if (!opencollectiveUsername) throw new Error('opencollectiveUsername is missing'); | ||
opencollectiveURL = "https://opencollective.com/".concat(opencollectiveUsername); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/open%20collective-donate-yellow.svg'; | ||
var url = opencollectiveURL; | ||
var alt = 'Open Collective donate button'; | ||
var title = 'Donate to this project using Open Collective'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/open%20collective-donate-yellow.svg'; | ||
var url = opencollectiveURL; | ||
var alt = 'Open Collective donate button'; | ||
var title = 'Donate to this project using Open Collective'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
opencollective.badgeCategory = 'funding'; | ||
/** | ||
@@ -494,21 +570,27 @@ * Gratipay Badge | ||
*/ | ||
function gratipay(_ref19) { | ||
var gratipayUsername = _ref19.gratipayUsername, | ||
gratipayURL = _ref19.gratipayURL; | ||
var gratipayUsername = _ref19.gratipayUsername, | ||
gratipayURL = _ref19.gratipayURL; | ||
// Check | ||
if (!gratipayURL) { | ||
if (!gratipayUsername) throw new Error('gratipayUsername is missing'); | ||
gratipayURL = 'https://gratipay.com/' + gratipayUsername; | ||
} | ||
// Check | ||
if (!gratipayURL) { | ||
if (!gratipayUsername) throw new Error('gratipayUsername is missing'); | ||
gratipayURL = "https://gratipay.com/".concat(gratipayUsername); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/gratipay-donate-yellow.svg'; | ||
var url = gratipayURL; | ||
var alt = 'Gratipay donate button'; | ||
var title = 'Donate weekly to this project using Gratipay'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/gratipay-donate-yellow.svg'; | ||
var url = gratipayURL; | ||
var alt = 'Gratipay donate button'; | ||
var title = 'Donate weekly to this project using Gratipay'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
gratipay.badgeCategory = 'funding'; | ||
/** | ||
@@ -523,27 +605,33 @@ * Flattr Badge | ||
*/ | ||
function flattr(_ref20) { | ||
var flattrCode = _ref20.flattrCode, | ||
flattrUsername = _ref20.flattrUsername, | ||
flattrURL = _ref20.flattrURL; | ||
var flattrCode = _ref20.flattrCode, | ||
flattrUsername = _ref20.flattrUsername, | ||
flattrURL = _ref20.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'); | ||
} | ||
} | ||
// Check | ||
if (!flattrURL) { | ||
if (flattrUsername) { | ||
flattrURL = "https://flattr.com/profile/".concat(flattrUsername); | ||
} else if (flattrCode) { | ||
flattrURL = "https://flattr.com/thing/".concat(flattrCode); | ||
} else { | ||
throw new Error('flattrUsername/flattrCode is missing'); | ||
} | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/flattr-donate-yellow.svg'; | ||
var url = flattrURL; | ||
var alt = 'Flattr donate button'; | ||
var title = 'Donate to this project using Flattr'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/flattr-donate-yellow.svg'; | ||
var url = flattrURL; | ||
var alt = 'Flattr donate button'; | ||
var title = 'Donate to this project using Flattr'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
flattr.badgeCategory = 'funding'; | ||
/** | ||
@@ -558,27 +646,33 @@ * Paypal Badge | ||
*/ | ||
function paypal(_ref21) { | ||
var paypalURL = _ref21.paypalURL, | ||
paypalButtonID = _ref21.paypalButtonID, | ||
paypalUsername = _ref21.paypalUsername; | ||
var paypalURL = _ref21.paypalURL, | ||
paypalButtonID = _ref21.paypalButtonID, | ||
paypalUsername = _ref21.paypalUsername; | ||
// Check | ||
if (!paypalURL) { | ||
if (paypalButtonID) { | ||
paypalURL = 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&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'); | ||
} | ||
} | ||
// Check | ||
if (!paypalURL) { | ||
if (paypalButtonID) { | ||
paypalURL = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=".concat(escape(paypalButtonID)); | ||
} else if (paypalUsername) { | ||
paypalURL = "https://paypal.me/".concat(paypalUsername); | ||
} else { | ||
throw new Error('paypalURL, paypalButtonID, or paypalUsername is missing, at least one must exist'); | ||
} | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/paypal-donate-yellow.svg'; | ||
var url = paypalURL; | ||
var alt = 'PayPal donate button'; | ||
var title = 'Donate to this project using Paypal'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/paypal-donate-yellow.svg'; | ||
var url = paypalURL; | ||
var alt = 'PayPal donate button'; | ||
var title = 'Donate to this project using Paypal'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
paypal.badgeCategory = 'funding'; | ||
/** | ||
@@ -591,18 +685,22 @@ * Crypto Badge | ||
*/ | ||
function crypto(_ref22) { | ||
var cryptoURL = _ref22.cryptoURL, | ||
bitcoinURL = _ref22.bitcoinURL; | ||
var cryptoURL = _ref22.cryptoURL, | ||
bitcoinURL = _ref22.bitcoinURL; | ||
// Check | ||
var url = cryptoURL || bitcoinURL; | ||
if (!url) throw new Error('cryptoURL is missing'); // Create | ||
// Check | ||
var url = cryptoURL || bitcoinURL; | ||
if (!url) throw new Error('cryptoURL is missing'); | ||
var image = 'https://img.shields.io/badge/crypto-donate-yellow.svg'; | ||
var alt = 'crypto donate button'; | ||
var title = 'Donate to this project using Cryptocurrency'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/badge/crypto-donate-yellow.svg'; | ||
var alt = 'crypto donate button'; | ||
var title = 'Donate to this project using Cryptocurrency'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
crypto.badgeCategory = 'funding'; | ||
/** | ||
@@ -614,7 +712,8 @@ * Crypto Badge | ||
*/ | ||
function bitcoin(opts) { | ||
return crypto(opts); | ||
return crypto(opts); | ||
} | ||
bitcoin.badgeCategory = 'funding'; | ||
/** | ||
@@ -627,17 +726,21 @@ * Wishlist Badge | ||
*/ | ||
function wishlist(_ref23) { | ||
var wishlistURL = _ref23.wishlistURL; | ||
var wishlistURL = _ref23.wishlistURL; | ||
// Check | ||
if (!wishlistURL) throw new Error('wishlistURL is missing'); // Create | ||
// Check | ||
if (!wishlistURL) throw new Error('wishlistURL is missing'); | ||
var image = 'https://img.shields.io/badge/wishlist-donate-yellow.svg'; | ||
var url = wishlistURL; | ||
var alt = 'Wishlist browse button'; | ||
var title = 'Buy an item on our wishlist for us'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/badge/wishlist-donate-yellow.svg'; | ||
var url = wishlistURL; | ||
var alt = 'Wishlist browse button'; | ||
var title = 'Buy an item on our wishlist for us'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
wishlist.badgeCategory = 'funding'; | ||
/** | ||
@@ -651,21 +754,27 @@ * Buy Me A Coffee Badge | ||
*/ | ||
function buymeacoffee(_ref24) { | ||
var buymeacoffeeUsername = _ref24.buymeacoffeeUsername, | ||
buymeacoffeeURL = _ref24.buymeacoffeeURL; | ||
var buymeacoffeeUsername = _ref24.buymeacoffeeUsername, | ||
buymeacoffeeURL = _ref24.buymeacoffeeURL; | ||
// Check | ||
if (!buymeacoffeeURL) { | ||
if (!buymeacoffeeUsername) throw new Error('buymeacoffeeUsername is missing'); | ||
buymeacoffeeURL = 'https://buymeacoffee.com/' + buymeacoffeeUsername; | ||
} | ||
// Check | ||
if (!buymeacoffeeURL) { | ||
if (!buymeacoffeeUsername) throw new Error('buymeacoffeeUsername is missing'); | ||
buymeacoffeeURL = "https://buymeacoffee.com/".concat(buymeacoffeeUsername); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg'; | ||
var url = buymeacoffeeURL; | ||
var alt = 'Buy Me A Coffee donate button'; | ||
var title = 'Donate to this project using Buy Me A Coffee'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg'; | ||
var url = buymeacoffeeURL; | ||
var alt = 'Buy Me A Coffee donate button'; | ||
var title = 'Donate to this project using Buy Me A Coffee'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
buymeacoffee.badgeCategory = 'funding'; | ||
/** | ||
@@ -679,21 +788,27 @@ * Liberapay Badge | ||
*/ | ||
function liberapay(_ref25) { | ||
var liberapayUsername = _ref25.liberapayUsername, | ||
liberapayURL = _ref25.liberapayURL; | ||
var liberapayUsername = _ref25.liberapayUsername, | ||
liberapayURL = _ref25.liberapayURL; | ||
// Check | ||
if (!liberapayURL) { | ||
if (!liberapayUsername) throw new Error('liberapayUsername is missing'); | ||
liberapayURL = 'https://liberapay.com/' + liberapayUsername; | ||
} | ||
// Check | ||
if (!liberapayURL) { | ||
if (!liberapayUsername) throw new Error('liberapayUsername is missing'); | ||
liberapayURL = "https://liberapay.com/".concat(liberapayUsername); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/liberapay-donate-yellow.svg'; | ||
var url = liberapayURL; | ||
var alt = 'Liberapay donate button'; | ||
var title = 'Donate to this project using Liberapay'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/liberapay-donate-yellow.svg'; | ||
var url = liberapayURL; | ||
var alt = 'Liberapay donate button'; | ||
var title = 'Donate to this project using Liberapay'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
liberapay.badgeCategory = 'funding'; | ||
/** | ||
@@ -709,30 +824,36 @@ * Thanks App Badge | ||
*/ | ||
function thanksapp(_ref26) { | ||
var npmPackageName = _ref26.npmPackageName, | ||
githubSlug = _ref26.githubSlug, | ||
thanksappUsername = _ref26.thanksappUsername, | ||
thanksappURL = _ref26.thanksappURL; | ||
var npmPackageName = _ref26.npmPackageName, | ||
githubSlug = _ref26.githubSlug, | ||
thanksappUsername = _ref26.thanksappUsername, | ||
thanksappURL = _ref26.thanksappURL; | ||
// Check | ||
if (!thanksappURL) { | ||
if (thanksappUsername) { | ||
thanksappURL = 'https://givethanks.app/u/' + githubSlug; | ||
} 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'); | ||
} | ||
} | ||
// Check | ||
if (!thanksappURL) { | ||
if (thanksappUsername) { | ||
thanksappURL = "https://givethanks.app/u/".concat(githubSlug); | ||
} else if (npmPackageName) { | ||
thanksappURL = "https://givethanks.app/donate/npm/".concat(npmPackageName); | ||
} else if (githubSlug) { | ||
thanksappURL = "https://givethanks.app/donate/github/".concat(githubSlug); | ||
} else { | ||
throw new Error('at least one of these is required: thanksappUsername, npmPackageName, githubSlug'); | ||
} | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg'; | ||
var url = thanksappURL; | ||
var alt = 'Thanks App donate button'; | ||
var title = 'Donate to this project using Thanks App'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg'; | ||
var url = thanksappURL; | ||
var alt = 'Thanks App donate button'; | ||
var title = 'Donate to this project using Thanks App'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
thanksapp.badgeCategory = 'funding'; | ||
/** | ||
@@ -745,18 +866,21 @@ * Boost Lab Badge | ||
*/ | ||
function boostlab(_ref27) { | ||
var githubSlug = _ref27.githubSlug; | ||
var githubSlug = _ref27.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
// Create | ||
var image = 'https://img.shields.io/badge/boostlab-donate-yellow.svg'; | ||
var url = 'https://boost-lab.app/' + githubSlug; | ||
var alt = 'Boost Lab donate button'; | ||
var title = 'Donate to this project using Boost Lab'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/boostlab-donate-yellow.svg'; | ||
var url = "https://boost-lab.app/".concat(githubSlug); | ||
var alt = 'Boost Lab donate button'; | ||
var title = 'Donate to this project using Boost Lab'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
boostlab.badgeCategory = 'funding'; | ||
// ==================================== | ||
boostlab.badgeCategory = 'funding'; // ==================================== | ||
// Social Badges | ||
@@ -771,14 +895,13 @@ | ||
*/ | ||
function slackinscript(_ref28) { | ||
var slackinURL = _ref28.slackinURL; | ||
var slackinURL = _ref28.slackinURL; | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing'); // Create | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing'); | ||
return "<script async defer src=\"".concat(slackinURL, "/slackin.js\"></script>"); | ||
} | ||
// Create | ||
return '<script async defer src="' + slackinURL + '/slackin.js"></script>'; | ||
} | ||
slackinscript.badgeCategory = 'social'; | ||
slackinscript.badgeScript = true; | ||
/** | ||
@@ -791,17 +914,21 @@ * Slackin Badge | ||
*/ | ||
function slackin(_ref29) { | ||
var slackinURL = _ref29.slackinURL; | ||
var slackinURL = _ref29.slackinURL; | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing'); // Create | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing'); | ||
var image = "".concat(slackinURL, "/badge.svg"); | ||
var url = slackinURL; | ||
var alt = 'Slack community badge'; | ||
var title = "Join this project's slack community"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = slackinURL + '/badge.svg'; | ||
var url = slackinURL; | ||
var alt = 'Slack community badge'; | ||
var title = 'Join this project\'s slack community'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
slackin.badgeCategory = 'social'; | ||
/** | ||
@@ -816,19 +943,23 @@ * Google Analytics Beacon Badge | ||
*/ | ||
function gabeacon(_ref30) { | ||
var gaTrackingID = _ref30.gaTrackingID, | ||
githubSlug = _ref30.githubSlug; | ||
var gaTrackingID = _ref30.gaTrackingID, | ||
githubSlug = _ref30.githubSlug; | ||
// Check | ||
if (!gaTrackingID) throw new Error('gaTrackingID is missing'); | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!gaTrackingID) throw new Error('gaTrackingID is missing'); | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://ga-beacon.appspot.com/".concat(gaTrackingID, "/").concat(githubSlug); | ||
var url = 'https://github.com/igrigorik/ga-beacon'; | ||
var alt = 'Google Analytics beacon image'; | ||
var title = 'Get Google Analytics for your project'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://ga-beacon.appspot.com/' + gaTrackingID + '/' + githubSlug; | ||
var url = 'https://github.com/igrigorik/ga-beacon'; | ||
var alt = 'Google Analytics beacon image'; | ||
var title = 'Get Google Analytics for your project'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
gabeacon.badgeCategory = 'social'; | ||
/** | ||
@@ -841,14 +972,13 @@ * Google Plus One Button | ||
*/ | ||
function googleplusone(_ref31) { | ||
var homepage = _ref31.homepage; | ||
var homepage = _ref31.homepage; | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); // Create | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); | ||
return "<span class=\"g-plusone\" data-size=\"medium\" data-href=\"".concat(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>"); | ||
} | ||
// 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; | ||
/** | ||
@@ -861,14 +991,13 @@ * Reddit Submit Button | ||
*/ | ||
function redditsubmit(_ref32) { | ||
var homepage = _ref32.homepage; | ||
var homepage = _ref32.homepage; | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); // Create | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); | ||
return "<script>reddit_url=\"".concat(homepage, "\"</script><script src=\"https://en.reddit.com/static/button/button1.js\"></script>"); | ||
} | ||
// Create | ||
return '<script>reddit_url="' + homepage + '"</script><script src="https://en.reddit.com/static/button/button1.js"></script>'; | ||
} | ||
redditsubmit.badgeCategory = 'social'; | ||
redditsubmit.badgeScript = true; | ||
/** | ||
@@ -881,14 +1010,13 @@ * Hacker News Submit Button | ||
*/ | ||
function hackernewssubmit(_ref33) { | ||
var homepage = _ref33.homepage; | ||
var homepage = _ref33.homepage; | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); // Create | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); | ||
return "<a href=\"https://news.ycombinator.com/submit\" class=\"hn-button\" data-url=\"".concat(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>"); | ||
} | ||
// 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; | ||
/** | ||
@@ -902,17 +1030,16 @@ * Facebook Like Button | ||
*/ | ||
function facebooklike(_ref34) { | ||
var homepage = _ref34.homepage, | ||
facebookApplicationID = _ref34.facebookApplicationID; | ||
var homepage = _ref34.homepage, | ||
facebookApplicationID = _ref34.facebookApplicationID; | ||
// Prepare | ||
if (!homepage) throw new Error('homepage is missing'); | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID; | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing'); // Return | ||
// Prepare | ||
if (!homepage) throw new Error('homepage is missing'); | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID; | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing'); | ||
return "<iframe src=\"https://www.facebook.com/plugins/like.php?href=".concat(escape(homepage), "&send=false&layout=button_count&width=450&show_faces=false&font&colorscheme=light&action=like&height=21&appId=").concat(escape(facebookApplicationID), "\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height:21px;\" allowTransparency=\"true\"></iframe>"); | ||
} | ||
// Return | ||
return '<iframe src="https://www.facebook.com/plugins/like.php?href=' + escape(homepage) + '&send=false&layout=button_count&width=450&show_faces=false&font&colorscheme=light&action=like&height=21&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; | ||
/** | ||
@@ -926,17 +1053,16 @@ * Facebook Follow Button | ||
*/ | ||
function facebookfollow(_ref35) { | ||
var facebookUsername = _ref35.facebookUsername, | ||
facebookApplicationID = _ref35.facebookApplicationID; | ||
var facebookUsername = _ref35.facebookUsername, | ||
facebookApplicationID = _ref35.facebookApplicationID; | ||
// Prepare | ||
if (!facebookUsername) throw new Error('facebookUsername is missing'); | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID; | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing'); // Return | ||
// Prepare | ||
if (!facebookUsername) throw new Error('facebookUsername is missing'); | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID; | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing'); | ||
return "<iframe src=\"https://www.facebook.com/plugins/follow.php?href=https%3A%2F%2Fwww.facebook.com%2F".concat(escape(facebookUsername), "&layout=button_count&show_faces=false&colorscheme=light&font&width=450&appId=").concat(escape(facebookApplicationID), "\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height: 20px;\" allowTransparency=\"true\"></iframe>"); | ||
} | ||
// Return | ||
return '<iframe src="https://www.facebook.com/plugins/follow.php?href=https%3A%2F%2Fwww.facebook.com%2F' + escape(facebookUsername) + '&layout=button_count&show_faces=false&colorscheme=light&font&width=450&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; | ||
/** | ||
@@ -949,14 +1075,13 @@ * Twitter Tweet Button | ||
*/ | ||
function twittertweet(_ref36) { | ||
var twitterUsername = _ref36.twitterUsername; | ||
var twitterUsername = _ref36.twitterUsername; | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing'); // Return | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing'); | ||
return "<a href=\"https://twitter.com/share\" class=\"twitter-share-button\" data-via=\"".concat(twitterUsername, "\" data-related=\"").concat(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>"); | ||
} | ||
// 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; | ||
/** | ||
@@ -969,14 +1094,13 @@ * Twitter Follow Button | ||
*/ | ||
function twitterfollow(_ref37) { | ||
var twitterUsername = _ref37.twitterUsername; | ||
var twitterUsername = _ref37.twitterUsername; | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing'); // Return | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing'); | ||
return "<a href=\"https://twitter.com/".concat(escape(twitterUsername), "\" class=\"twitter-follow-button\" data-show-count=\"false\">Follow @").concat(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>"); | ||
} | ||
// 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; | ||
/** | ||
@@ -989,14 +1113,13 @@ * Github Follow Button | ||
*/ | ||
function githubfollow(_ref38) { | ||
var githubUsername = _ref38.githubUsername; | ||
var githubUsername = _ref38.githubUsername; | ||
// Prepare | ||
if (!githubUsername) throw new Error('githubUsername is missing'); // Return | ||
// Prepare | ||
if (!githubUsername) throw new Error('githubUsername is missing'); | ||
return "<iframe src=\"https://ghbtns.com/github-btn.html?user=".concat(escape(githubUsername), "&type=follow&count=true\" allowtransparency=\"true\" frameborder=\"0\" scrolling=\"0\" width=\"165\" height=\"20\"></iframe>"); | ||
} | ||
// Return | ||
return '<iframe src="https://ghbtns.com/github-btn.html?user=' + escape(githubUsername) + '&type=follow&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="165" height="20"></iframe>'; | ||
} | ||
githubfollow.badgeCategory = 'social'; | ||
githubfollow.badgeScript = true; | ||
/** | ||
@@ -1009,18 +1132,17 @@ * GitHub Star Button | ||
*/ | ||
function githubstar(_ref39) { | ||
var githubSlug = _ref39.githubSlug; | ||
var githubSlug = _ref39.githubSlug; | ||
// Prepare | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var split = githubSlug.split('/'); | ||
var githubUsername = split[0]; | ||
var githubRepository = split[1]; | ||
if (!githubUsername || !githubRepository) throw new Error('githubSlug is invalid'); // Return | ||
// Prepare | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var split = githubSlug.split('/'); | ||
var githubUsername = split[0]; | ||
var githubRepository = split[1]; | ||
if (!githubUsername || !githubRepository) throw new Error('githubSlug is invalid'); | ||
return "<iframe src=\"https://ghbtns.com/github-btn.html?user=".concat(escape(githubUsername), "&repo=").concat(escape(githubRepository), "&type=watch&count=true\" allowtransparency=\"true\" frameborder=\"0\" scrolling=\"0\" width=\"110\" height=\"20\"></iframe>"); | ||
} | ||
// Return | ||
return '<iframe src="https://ghbtns.com/github-btn.html?user=' + escape(githubUsername) + '&repo=' + escape(githubRepository) + '&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>'; | ||
} | ||
githubstar.badgeCategory = 'social'; | ||
githubstar.badgeScript = true; | ||
/** | ||
@@ -1035,61 +1157,60 @@ * Quora Follow Button | ||
*/ | ||
function quorafollow(_ref40) { | ||
var quoraUsername = _ref40.quoraUsername, | ||
quoraRealname = _ref40.quoraRealname, | ||
quoraCode = _ref40.quoraCode; | ||
var quoraUsername = _ref40.quoraUsername, | ||
quoraRealname = _ref40.quoraRealname, | ||
quoraCode = _ref40.quoraCode; | ||
// Prepare | ||
if (!quoraUsername) throw new Error('quoraUsername is missing'); | ||
quoraRealname = quoraRealname || quoraUsername.replace(/-/g, ' '); | ||
quoraCode = quoraCode || '7N31XJs'; // Return | ||
// Prepare | ||
if (!quoraUsername) throw new Error('quoraUsername is missing'); | ||
quoraRealname = quoraRealname || quoraUsername.replace(/-/g, ' '); | ||
quoraCode = quoraCode || '7N31XJs'; | ||
return "\n\t\t<span data-name=\"".concat(quoraUsername, "\">\n\t\t\tFollow <a href=\"http://www.quora.com/").concat(quoraUsername, "\">").concat(quoraRealname, "</a> on <a href=\"http://www.quora.com\">Quora</a>\n\t\t\t<script src=\"https://www.quora.com/widgets/follow?embed_code=").concat(escape(quoraCode), "\"></script>\n\t\t</span>").replace(/\n\s*/g, ''); | ||
} | ||
// Return | ||
return ('\n\t\t<span data-name="' + quoraUsername + '">\n\t\t\tFollow <a href="http://www.quora.com/' + quoraUsername + '">' + quoraRealname + '</a> on <a href="http://www.quora.com">Quora</a>\n\t\t\t<script src="https://www.quora.com/widgets/follow?embed_code=' + escape(quoraCode) + '"></script>\n\t\t</span>').replace(/\n\s*/g, ''); | ||
} | ||
quorafollow.badgeCategory = 'social'; | ||
quorafollow.badgeScript = true; | ||
quorafollow.badgeScript = true; // Export | ||
// 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 | ||
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 | ||
}; |
@@ -1,7 +0,4 @@ | ||
'use strict'; | ||
'use strict'; // Import | ||
// Import | ||
var badges = require('./badges'); | ||
var badges = require('./badges.js'); | ||
/** | ||
@@ -14,24 +11,22 @@ Render a specified badge with the appropriate wrapping (div if block badge, span if inline badge) | ||
*/ | ||
function renderBadge(badgeName) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (badgeName === '---') { | ||
return '<br class="badge-separator" />'; | ||
} | ||
if (badgeName === '---') { | ||
return '<br class="badge-separator" />'; | ||
} // Fetch | ||
// Fetch | ||
var badgeMethod = badges[badgeName]; | ||
// Send the badge value and options to the render method | ||
var badgeResult = badgeMethod(config).trim(); | ||
if (!badgeResult) return ''; | ||
var badgeMethod = badges[badgeName]; // Send the badge value and options to the render method | ||
// We have a result, so let's wrap it | ||
var elementName = badgeMethod.badgeInline === false ? 'div' : 'span'; | ||
var wrappedResult = '<' + elementName + ' class="badge-' + badgeName + '">' + badgeResult + '</' + elementName + '>'; | ||
var badgeResult = badgeMethod(config).trim(); | ||
if (!badgeResult) return ''; // We have a result, so let's wrap it | ||
// Done | ||
return wrappedResult; | ||
var elementName = badgeMethod.badgeInline === false ? 'div' : 'span'; | ||
var wrappedResult = "<".concat(elementName, " class=\"badge-").concat(badgeName, "\">").concat(badgeResult, "</").concat(elementName, ">"); // Done | ||
return wrappedResult; | ||
} | ||
/** | ||
@@ -45,54 +40,51 @@ Render specified badges with wrapping | ||
*/ | ||
function renderBadges(list) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { filterCategory: false, filterScripts: true }; | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { | ||
filterCategory: false, | ||
filterScripts: true | ||
}; | ||
// Prepare | ||
var results = []; // Render the badges | ||
// Prepare | ||
var results = []; | ||
list.forEach(function (badgeName) { | ||
var badgeConfig = config; // Custom Config? | ||
// Render the badges | ||
list.forEach(function (badgeName) { | ||
var badgeConfig = config; | ||
if (Array.isArray(badgeName)) { | ||
badgeConfig = badgeName[1]; | ||
badgeName = badgeName[0]; | ||
} // Seperator? | ||
// 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 if (badges[badgeName]) { | ||
// Category? | ||
if (options.filterCategory && options.filterCategory !== badges[badgeName].badgeCategory) return; | ||
if (badgeName === '---') { | ||
// Do not render seperators if we only wanted a single category | ||
if (options.filterCategory) return; | ||
} // Exists? | ||
else if (badges[badgeName]) { | ||
// Category? | ||
if (options.filterCategory && options.filterCategory !== badges[badgeName].badgeCategory) return; // Script? | ||
// Script? | ||
if (options.filterScripts && badges[badgeName].badgeScript) return; | ||
} | ||
// Doesn't exist | ||
else { | ||
throw new Error('the badge ' + badgeName + ' does not exist'); | ||
} | ||
if (options.filterScripts && badges[badgeName].badgeScript) return; | ||
} // Doesn't exist | ||
else { | ||
throw new Error("the badge ".concat(badgeName, " does not exist")); | ||
} // Render | ||
// Render | ||
var badgeResult = renderBadge(badgeName, badgeConfig).trim(); | ||
if (!badgeResult) return; | ||
// Rendered successfully, add the result | ||
results.push(badgeResult); | ||
}); | ||
var badgeResult = renderBadge(badgeName, badgeConfig).trim(); | ||
if (!badgeResult) return; // Rendered successfully, add the result | ||
// Return | ||
return results.join('\n'); | ||
} | ||
results.push(badgeResult); | ||
}); // Return | ||
// Export | ||
return results.join('\n'); | ||
} // Export | ||
module.exports = { | ||
badges: badges, | ||
renderBadge: renderBadge, | ||
renderBadges: renderBadges | ||
badges: badges, | ||
renderBadge: renderBadge, | ||
renderBadges: renderBadges | ||
}; |
@@ -1,10 +0,6 @@ | ||
'use strict'; | ||
'use strict'; // Import | ||
// Import | ||
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); } | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var querystring = require('querystring'); | ||
// ==================================== | ||
var querystring = require('querystring'); // ==================================== | ||
// Custom Badges | ||
@@ -23,20 +19,22 @@ | ||
*/ | ||
function badge(_ref) { | ||
var image = _ref.image, | ||
alt = _ref.alt, | ||
url = _ref.url, | ||
title = _ref.title; | ||
var image = _ref.image, | ||
alt = _ref.alt, | ||
url = _ref.url, | ||
title = _ref.title; | ||
// Check | ||
if (!image) throw new Error('image is missing'); // Create | ||
// Check | ||
if (!image) throw new Error('image is missing'); | ||
var result = alt ? "<img src=\"".concat(image, "\" alt=\"").concat(alt, "\" />") : "<img src=\"".concat(image, "\" />"); | ||
// Create | ||
var 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; | ||
if (url) { | ||
result = (title ? "<a href=\"".concat(url, "\" title=\"").concat(title, "\">") : "<a href=\"".concat(url, "\">")) + result + '</a>'; | ||
} | ||
return result; | ||
} | ||
badge.badgeCategory = 'custom'; | ||
/** | ||
@@ -54,22 +52,25 @@ * Shields Custom Badge | ||
*/ | ||
function shields(_ref2) { | ||
var left = _ref2.left, | ||
right = _ref2.right, | ||
_ref2$color = _ref2.color, | ||
color = _ref2$color === undefined ? 'yellow' : _ref2$color, | ||
alt = _ref2.alt, | ||
url = _ref2.url, | ||
title = _ref2.title; | ||
var left = _ref2.left, | ||
right = _ref2.right, | ||
_ref2$color = _ref2.color, | ||
color = _ref2$color === void 0 ? 'yellow' : _ref2$color, | ||
alt = _ref2.alt, | ||
url = _ref2.url, | ||
title = _ref2.title; | ||
// Check | ||
if (!left) throw new Error('left is missing'); | ||
if (!right) throw new Error('right is missing'); // Create | ||
// Check | ||
if (!left) throw new Error('left is missing'); | ||
if (!right) throw new Error('right is missing'); | ||
// Create | ||
var image = 'https://img.shields.io/badge/' + left + '-' + right + '-' + color + '.svg'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = "https://img.shields.io/badge/".concat(left, "-").concat(right, "-").concat(color, ".svg"); | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
shields.badgeCategory = 'custom'; | ||
// ==================================== | ||
shields.badgeCategory = 'custom'; // ==================================== | ||
// Development Badges | ||
@@ -84,17 +85,21 @@ | ||
*/ | ||
function npmversion(_ref3) { | ||
var npmPackageName = _ref3.npmPackageName; | ||
var npmPackageName = _ref3.npmPackageName; | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); // Create | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
var image = "https://img.shields.io/npm/v/".concat(npmPackageName, ".svg"); | ||
var url = "https://npmjs.org/package/".concat(npmPackageName); | ||
var alt = 'NPM version'; | ||
var title = 'View this project on NPM'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/npm/v/' + npmPackageName + '.svg'; | ||
var url = 'https://npmjs.org/package/' + npmPackageName; | ||
var alt = 'NPM version'; | ||
var title = 'View this project on NPM'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
npmversion.badgeCategory = 'development'; | ||
/** | ||
@@ -107,16 +112,20 @@ * NPM Downloads Badge | ||
*/ | ||
function npmdownloads(_ref4) { | ||
var npmPackageName = _ref4.npmPackageName; | ||
var npmPackageName = _ref4.npmPackageName; | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
var image = "https://img.shields.io/npm/dm/".concat(npmPackageName, ".svg"); | ||
var url = "https://npmjs.org/package/".concat(npmPackageName); | ||
var alt = 'NPM downloads'; | ||
var title = 'View this project on NPM'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
var image = 'https://img.shields.io/npm/dm/' + npmPackageName + '.svg'; | ||
var url = 'https://npmjs.org/package/' + npmPackageName; | ||
var alt = 'NPM downloads'; | ||
var title = 'View this project on NPM'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
npmdownloads.badgeCategory = 'development'; | ||
/** | ||
@@ -129,17 +138,21 @@ * David DM Dependencies Badge | ||
*/ | ||
function daviddm(_ref5) { | ||
var githubSlug = _ref5.githubSlug; | ||
var githubSlug = _ref5.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://img.shields.io/david/".concat(githubSlug, ".svg"); | ||
var url = "https://david-dm.org/".concat(githubSlug); | ||
var alt = 'Dependency Status'; | ||
var title = "View the status of this project's dependencies on DavidDM"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/david/' + githubSlug + '.svg'; | ||
var url = 'https://david-dm.org/' + githubSlug; | ||
var alt = 'Dependency Status'; | ||
var title = "View the status of this project's dependencies on DavidDM"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
daviddm.badgeCategory = 'development'; | ||
/** | ||
@@ -152,17 +165,21 @@ * David DM Dev Dependencies Badge | ||
*/ | ||
function daviddmdev(_ref6) { | ||
var githubSlug = _ref6.githubSlug; | ||
var githubSlug = _ref6.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://img.shields.io/david/dev/".concat(githubSlug, ".svg"); | ||
var url = "https://david-dm.org/".concat(githubSlug, "#info=devDependencies"); | ||
var alt = 'Dev Dependency Status'; | ||
var title = "View the status of this project's development dependencies on DavidDM"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/david/dev/' + githubSlug + '.svg'; | ||
var url = 'https://david-dm.org/' + githubSlug + '#info=devDependencies'; | ||
var alt = 'Dev Dependency Status'; | ||
var title = "View the status of this project's development dependencies on DavidDM"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
daviddmdev.badgeCategory = 'development'; | ||
/** | ||
@@ -178,24 +195,29 @@ * Nodei.co Badge | ||
*/ | ||
function nodeico(_ref7) { | ||
var npmPackageName = _ref7.npmPackageName, | ||
nodeicoQueryString = _ref7.nodeicoQueryString; | ||
var npmPackageName = _ref7.npmPackageName, | ||
nodeicoQueryString = _ref7.nodeicoQueryString; | ||
// Prepare | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
// Prepare | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
if (nodeicoQueryString && typeof nodeicoQueryString !== 'string' && (typeof nodeicoQueryString === 'undefined' ? 'undefined' : _typeof(nodeicoQueryString)) !== 'object') { | ||
throw new Error('nodeicoQueryString must be a string or an object'); | ||
} | ||
if (nodeicoQueryString && typeof nodeicoQueryString !== 'string' && _typeof(nodeicoQueryString) !== 'object') { | ||
throw new Error('nodeicoQueryString must be a string or an object'); | ||
} // Return | ||
// Return | ||
var url = 'https://www.npmjs.com/package/' + npmPackageName; | ||
var alt = 'Nodei.co badge'; | ||
var title = 'Nodei.co badge'; | ||
var image = 'https://nodei.co/npm/' + npmPackageName + '.png'; | ||
var query = (typeof nodeicoQueryString === 'undefined' ? 'undefined' : _typeof(nodeicoQueryString)) === 'object' ? querystring.stringify(nodeicoQueryString) : nodeicoQueryString; | ||
if (query) image += '?' + query; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var url = "https://www.npmjs.com/package/".concat(npmPackageName); | ||
var alt = 'Nodei.co badge'; | ||
var title = 'Nodei.co badge'; | ||
var image = "https://nodei.co/npm/".concat(npmPackageName, ".png"); | ||
var query = _typeof(nodeicoQueryString) === 'object' ? querystring.stringify(nodeicoQueryString) : nodeicoQueryString; | ||
if (query) image += "?".concat(query); | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
nodeico.badgeCategory = 'development'; | ||
// ==================================== | ||
nodeico.badgeCategory = 'development'; // ==================================== | ||
// Testing Badges | ||
@@ -210,21 +232,25 @@ | ||
*/ | ||
function saucelabsbm(_ref8) { | ||
var saucelabsUsername = _ref8.saucelabsUsername, | ||
saucelabsAuthToken = _ref8.saucelabsAuthToken; | ||
var saucelabsUsername = _ref8.saucelabsUsername, | ||
saucelabsAuthToken = _ref8.saucelabsAuthToken; | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing'); | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN; | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing'); // Create | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing'); | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN; | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing'); | ||
var image = "https://saucelabs.com/browser-matrix/".concat(saucelabsUsername, ".svg?auth=").concat(escape(saucelabsAuthToken)); | ||
var url = "https://saucelabs.com/u/".concat(saucelabsUsername); | ||
var alt = 'Sauce Labs Browser Matrix'; | ||
var title = "Check this project's browser tests on Sauce Labs"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://saucelabs.com/browser-matrix/' + saucelabsUsername + '.svg?auth=' + escape(saucelabsAuthToken); | ||
var url = 'https://saucelabs.com/u/' + saucelabsUsername; | ||
var alt = 'Sauce Labs Browser Matrix'; | ||
var title = "Check this project's browser tests on Sauce Labs"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
saucelabsbm.badgeCategory = 'testing'; | ||
saucelabsbm.badgeInline = false; | ||
/** | ||
@@ -238,20 +264,24 @@ * Sauce Labs Badge | ||
*/ | ||
function saucelabs(_ref9) { | ||
var saucelabsUsername = _ref9.saucelabsUsername, | ||
saucelabsAuthToken = _ref9.saucelabsAuthToken; | ||
var saucelabsUsername = _ref9.saucelabsUsername, | ||
saucelabsAuthToken = _ref9.saucelabsAuthToken; | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing'); | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN; | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing'); // Create | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing'); | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN; | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing'); | ||
var image = "https://saucelabs.com/browser-matrix/".concat(saucelabsUsername, ".svg?auth=").concat(escape(saucelabsAuthToken)); | ||
var url = "https://saucelabs.com/u/".concat(saucelabsUsername); | ||
var alt = 'Sauce Labs Browser Matrix'; | ||
var title = "Check this project's browser tests on Sauce Labs"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://saucelabs.com/browser-matrix/' + saucelabsUsername + '.svg?auth=' + escape(saucelabsAuthToken); | ||
var url = 'https://saucelabs.com/u/' + saucelabsUsername; | ||
var alt = 'Sauce Labs Browser Matrix'; | ||
var title = "Check this project's browser tests on Sauce Labs"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
saucelabs.badgeCategory = 'testing'; | ||
/** | ||
@@ -262,19 +292,28 @@ * Travis CI Badge | ||
* @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 | ||
*/ | ||
function travisci(_ref10) { | ||
var githubSlug = _ref10.githubSlug; | ||
var githubSlug = _ref10.githubSlug, | ||
_ref10$travisTLD = _ref10.travisTLD, | ||
travisTLD = _ref10$travisTLD === void 0 ? 'org' : _ref10$travisTLD; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = ['https://img.shields.io/travis', travisTLD === 'com' ? 'com' : '', githubSlug, 'master.svg'].filter(function (i) { | ||
return Boolean(i); | ||
}).join('/'); | ||
var url = "http://travis-ci.".concat(travisTLD, "/").concat(githubSlug); | ||
var alt = 'Travis CI Build Status'; | ||
var title = "Check this project's build status on TravisCI"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/travis/' + githubSlug + '/master.svg'; | ||
var url = 'http://travis-ci.org/' + githubSlug; | ||
var alt = 'Travis CI Build Status'; | ||
var title = "Check this project's build status on TravisCI"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
travisci.badgeCategory = 'testing'; | ||
/** | ||
@@ -288,19 +327,23 @@ * Codeship Badge | ||
*/ | ||
function codeship(_ref11) { | ||
var codeshipProjectUUID = _ref11.codeshipProjectUUID, | ||
codeshipProjectID = _ref11.codeshipProjectID; | ||
var codeshipProjectUUID = _ref11.codeshipProjectUUID, | ||
codeshipProjectID = _ref11.codeshipProjectID; | ||
// Check | ||
if (!codeshipProjectUUID) throw new Error('codeshipProjectUUID is missing'); | ||
if (!codeshipProjectID) throw new Error('codeshipProjectID is missing'); // Create | ||
// Check | ||
if (!codeshipProjectUUID) throw new Error('codeshipProjectUUID is missing'); | ||
if (!codeshipProjectID) throw new Error('codeshipProjectID is missing'); | ||
var image = "https://img.shields.io/codeship/".concat(codeshipProjectUUID, "/master.svg"); | ||
var url = "https://www.codeship.io/projects/".concat(codeshipProjectID); | ||
var alt = 'Codeship Status'; | ||
var title = "Check this project's status on Codeship"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/codeship/' + codeshipProjectUUID + '/master.svg'; | ||
var url = 'https://www.codeship.io/projects/' + codeshipProjectID; | ||
var alt = 'Codeship Status'; | ||
var title = "Check this project's status on Codeship"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
codeship.badgeCategory = 'testing'; | ||
/** | ||
@@ -313,17 +356,21 @@ * Coveralls Badge | ||
*/ | ||
function coveralls(_ref12) { | ||
var githubSlug = _ref12.githubSlug; | ||
var githubSlug = _ref12.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://img.shields.io/coveralls/".concat(githubSlug, ".svg"); | ||
var url = "https://coveralls.io/r/".concat(githubSlug); | ||
var alt = 'Coveralls Coverage Status'; | ||
var title = "View this project's coverage on Coveralls"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/coveralls/' + githubSlug + '.svg'; | ||
var url = 'https://coveralls.io/r/' + githubSlug; | ||
var alt = 'Coveralls Coverage Status'; | ||
var title = "View this project's coverage on Coveralls"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
coveralls.badgeCategory = 'testing'; | ||
/** | ||
@@ -336,17 +383,21 @@ * Code Climate Rating Badge | ||
*/ | ||
function codeclimate(_ref13) { | ||
var githubSlug = _ref13.githubSlug; | ||
var githubSlug = _ref13.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://img.shields.io/codeclimate/github/".concat(githubSlug, ".svg"); | ||
var url = "https://codeclimate.com/github/".concat(githubSlug); | ||
var alt = 'Code Climate Rating'; | ||
var title = "View this project's rating on Code Climate"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/codeclimate/github/' + githubSlug + '.svg'; | ||
var url = 'https://codeclimate.com/github/' + githubSlug; | ||
var alt = 'Code Climate Rating'; | ||
var title = "View this project's rating on Code Climate"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
codeclimate.badgeCategory = 'testing'; | ||
/** | ||
@@ -359,17 +410,21 @@ * BitHound Score Badge | ||
*/ | ||
function bithound(_ref14) { | ||
var githubSlug = _ref14.githubSlug; | ||
var githubSlug = _ref14.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://bithound.io/github/".concat(githubSlug, "/badges/score.svg"); | ||
var url = "https://bithound.io/github/".concat(githubSlug); | ||
var alt = 'BitHound Score'; | ||
var title = "View this project's score on BitHound"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://bithound.io/github/' + githubSlug + '/badges/score.svg'; | ||
var url = 'https://bithound.io/github/' + githubSlug; | ||
var alt = 'BitHound Score'; | ||
var title = "View this project's score on BitHound"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
bithound.badgeCategory = 'testing'; | ||
/** | ||
@@ -382,19 +437,22 @@ * Waffle Badge | ||
*/ | ||
function waffle(_ref15) { | ||
var githubSlug = _ref15.githubSlug; | ||
var githubSlug = _ref15.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
// Create | ||
var label = 'ready'; | ||
var image = 'https://badge.waffle.io/' + githubSlug + '.png?label=' + escape(label); | ||
var url = 'http://waffle.io/' + githubSlug; | ||
var alt = 'Stories in Ready'; | ||
var title = "View this project's stories on Waffle.io"; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var label = 'ready'; | ||
var image = "https://badge.waffle.io/".concat(githubSlug, ".png?label=").concat(escape(label)); | ||
var url = "http://waffle.io/".concat(githubSlug); | ||
var alt = 'Stories in Ready'; | ||
var title = "View this project's stories on Waffle.io"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
waffle.badgeCategory = 'testing'; | ||
// ==================================== | ||
waffle.badgeCategory = 'testing'; // ==================================== | ||
// Funding Badges | ||
@@ -410,21 +468,27 @@ | ||
*/ | ||
function sixtydevstips(_ref16) { | ||
var sixtydevstipsID = _ref16.sixtydevstipsID, | ||
sixtydevstipsURL = _ref16.sixtydevstipsURL; | ||
var sixtydevstipsID = _ref16.sixtydevstipsID, | ||
sixtydevstipsURL = _ref16.sixtydevstipsURL; | ||
// Check | ||
if (!sixtydevstipsURL) { | ||
if (!sixtydevstipsID) throw new Error('sixtydevstipsID is missing'); | ||
sixtydevstipsURL = 'https://tips.60devs.com/tip/' + sixtydevstipsID; | ||
} | ||
// Check | ||
if (!sixtydevstipsURL) { | ||
if (!sixtydevstipsID) throw new Error('sixtydevstipsID is missing'); | ||
sixtydevstipsURL = "https://tips.60devs.com/tip/".concat(sixtydevstipsID); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/60devs-donate-yellow.svg'; | ||
var url = sixtydevstipsURL; | ||
var alt = '60devs tips donate button'; | ||
var title = 'Donate to this project using 60devs tips'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/60devs-donate-yellow.svg'; | ||
var url = sixtydevstipsURL; | ||
var alt = '60devs tips donate button'; | ||
var title = 'Donate to this project using 60devs tips'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
sixtydevstips.badgeCategory = 'funding'; | ||
/** | ||
@@ -438,21 +502,27 @@ * Patreon Badge | ||
*/ | ||
function patreon(_ref17) { | ||
var patreonUsername = _ref17.patreonUsername, | ||
patreonURL = _ref17.patreonURL; | ||
var patreonUsername = _ref17.patreonUsername, | ||
patreonURL = _ref17.patreonURL; | ||
// Check | ||
if (!patreonURL) { | ||
if (!patreonUsername) throw new Error('patreonUsername is missing'); | ||
patreonURL = 'https://patreon.com/' + patreonUsername; | ||
} | ||
// Check | ||
if (!patreonURL) { | ||
if (!patreonUsername) throw new Error('patreonUsername is missing'); | ||
patreonURL = "https://patreon.com/".concat(patreonUsername); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/patreon-donate-yellow.svg'; | ||
var url = patreonURL; | ||
var alt = 'Patreon donate button'; | ||
var title = 'Donate to this project using Patreon'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/patreon-donate-yellow.svg'; | ||
var url = patreonURL; | ||
var alt = 'Patreon donate button'; | ||
var title = 'Donate to this project using Patreon'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
patreon.badgeCategory = 'funding'; | ||
/** | ||
@@ -466,21 +536,27 @@ * Open Collective Badge | ||
*/ | ||
function opencollective(_ref18) { | ||
var opencollectiveUsername = _ref18.opencollectiveUsername, | ||
opencollectiveURL = _ref18.opencollectiveURL; | ||
var opencollectiveUsername = _ref18.opencollectiveUsername, | ||
opencollectiveURL = _ref18.opencollectiveURL; | ||
// Check | ||
if (!opencollectiveURL) { | ||
if (!opencollectiveUsername) throw new Error('opencollectiveUsername is missing'); | ||
opencollectiveURL = 'https://opencollective.com/' + opencollectiveUsername; | ||
} | ||
// Check | ||
if (!opencollectiveURL) { | ||
if (!opencollectiveUsername) throw new Error('opencollectiveUsername is missing'); | ||
opencollectiveURL = "https://opencollective.com/".concat(opencollectiveUsername); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/open%20collective-donate-yellow.svg'; | ||
var url = opencollectiveURL; | ||
var alt = 'Open Collective donate button'; | ||
var title = 'Donate to this project using Open Collective'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/open%20collective-donate-yellow.svg'; | ||
var url = opencollectiveURL; | ||
var alt = 'Open Collective donate button'; | ||
var title = 'Donate to this project using Open Collective'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
opencollective.badgeCategory = 'funding'; | ||
/** | ||
@@ -494,21 +570,27 @@ * Gratipay Badge | ||
*/ | ||
function gratipay(_ref19) { | ||
var gratipayUsername = _ref19.gratipayUsername, | ||
gratipayURL = _ref19.gratipayURL; | ||
var gratipayUsername = _ref19.gratipayUsername, | ||
gratipayURL = _ref19.gratipayURL; | ||
// Check | ||
if (!gratipayURL) { | ||
if (!gratipayUsername) throw new Error('gratipayUsername is missing'); | ||
gratipayURL = 'https://gratipay.com/' + gratipayUsername; | ||
} | ||
// Check | ||
if (!gratipayURL) { | ||
if (!gratipayUsername) throw new Error('gratipayUsername is missing'); | ||
gratipayURL = "https://gratipay.com/".concat(gratipayUsername); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/gratipay-donate-yellow.svg'; | ||
var url = gratipayURL; | ||
var alt = 'Gratipay donate button'; | ||
var title = 'Donate weekly to this project using Gratipay'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/gratipay-donate-yellow.svg'; | ||
var url = gratipayURL; | ||
var alt = 'Gratipay donate button'; | ||
var title = 'Donate weekly to this project using Gratipay'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
gratipay.badgeCategory = 'funding'; | ||
/** | ||
@@ -523,27 +605,33 @@ * Flattr Badge | ||
*/ | ||
function flattr(_ref20) { | ||
var flattrCode = _ref20.flattrCode, | ||
flattrUsername = _ref20.flattrUsername, | ||
flattrURL = _ref20.flattrURL; | ||
var flattrCode = _ref20.flattrCode, | ||
flattrUsername = _ref20.flattrUsername, | ||
flattrURL = _ref20.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'); | ||
} | ||
} | ||
// Check | ||
if (!flattrURL) { | ||
if (flattrUsername) { | ||
flattrURL = "https://flattr.com/profile/".concat(flattrUsername); | ||
} else if (flattrCode) { | ||
flattrURL = "https://flattr.com/thing/".concat(flattrCode); | ||
} else { | ||
throw new Error('flattrUsername/flattrCode is missing'); | ||
} | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/flattr-donate-yellow.svg'; | ||
var url = flattrURL; | ||
var alt = 'Flattr donate button'; | ||
var title = 'Donate to this project using Flattr'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/flattr-donate-yellow.svg'; | ||
var url = flattrURL; | ||
var alt = 'Flattr donate button'; | ||
var title = 'Donate to this project using Flattr'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
flattr.badgeCategory = 'funding'; | ||
/** | ||
@@ -558,27 +646,33 @@ * Paypal Badge | ||
*/ | ||
function paypal(_ref21) { | ||
var paypalURL = _ref21.paypalURL, | ||
paypalButtonID = _ref21.paypalButtonID, | ||
paypalUsername = _ref21.paypalUsername; | ||
var paypalURL = _ref21.paypalURL, | ||
paypalButtonID = _ref21.paypalButtonID, | ||
paypalUsername = _ref21.paypalUsername; | ||
// Check | ||
if (!paypalURL) { | ||
if (paypalButtonID) { | ||
paypalURL = 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&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'); | ||
} | ||
} | ||
// Check | ||
if (!paypalURL) { | ||
if (paypalButtonID) { | ||
paypalURL = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=".concat(escape(paypalButtonID)); | ||
} else if (paypalUsername) { | ||
paypalURL = "https://paypal.me/".concat(paypalUsername); | ||
} else { | ||
throw new Error('paypalURL, paypalButtonID, or paypalUsername is missing, at least one must exist'); | ||
} | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/paypal-donate-yellow.svg'; | ||
var url = paypalURL; | ||
var alt = 'PayPal donate button'; | ||
var title = 'Donate to this project using Paypal'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/paypal-donate-yellow.svg'; | ||
var url = paypalURL; | ||
var alt = 'PayPal donate button'; | ||
var title = 'Donate to this project using Paypal'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
paypal.badgeCategory = 'funding'; | ||
/** | ||
@@ -591,18 +685,22 @@ * Crypto Badge | ||
*/ | ||
function crypto(_ref22) { | ||
var cryptoURL = _ref22.cryptoURL, | ||
bitcoinURL = _ref22.bitcoinURL; | ||
var cryptoURL = _ref22.cryptoURL, | ||
bitcoinURL = _ref22.bitcoinURL; | ||
// Check | ||
var url = cryptoURL || bitcoinURL; | ||
if (!url) throw new Error('cryptoURL is missing'); // Create | ||
// Check | ||
var url = cryptoURL || bitcoinURL; | ||
if (!url) throw new Error('cryptoURL is missing'); | ||
var image = 'https://img.shields.io/badge/crypto-donate-yellow.svg'; | ||
var alt = 'crypto donate button'; | ||
var title = 'Donate to this project using Cryptocurrency'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/badge/crypto-donate-yellow.svg'; | ||
var alt = 'crypto donate button'; | ||
var title = 'Donate to this project using Cryptocurrency'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
crypto.badgeCategory = 'funding'; | ||
/** | ||
@@ -614,7 +712,8 @@ * Crypto Badge | ||
*/ | ||
function bitcoin(opts) { | ||
return crypto(opts); | ||
return crypto(opts); | ||
} | ||
bitcoin.badgeCategory = 'funding'; | ||
/** | ||
@@ -627,17 +726,21 @@ * Wishlist Badge | ||
*/ | ||
function wishlist(_ref23) { | ||
var wishlistURL = _ref23.wishlistURL; | ||
var wishlistURL = _ref23.wishlistURL; | ||
// Check | ||
if (!wishlistURL) throw new Error('wishlistURL is missing'); // Create | ||
// Check | ||
if (!wishlistURL) throw new Error('wishlistURL is missing'); | ||
var image = 'https://img.shields.io/badge/wishlist-donate-yellow.svg'; | ||
var url = wishlistURL; | ||
var alt = 'Wishlist browse button'; | ||
var title = 'Buy an item on our wishlist for us'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/badge/wishlist-donate-yellow.svg'; | ||
var url = wishlistURL; | ||
var alt = 'Wishlist browse button'; | ||
var title = 'Buy an item on our wishlist for us'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
wishlist.badgeCategory = 'funding'; | ||
/** | ||
@@ -651,21 +754,27 @@ * Buy Me A Coffee Badge | ||
*/ | ||
function buymeacoffee(_ref24) { | ||
var buymeacoffeeUsername = _ref24.buymeacoffeeUsername, | ||
buymeacoffeeURL = _ref24.buymeacoffeeURL; | ||
var buymeacoffeeUsername = _ref24.buymeacoffeeUsername, | ||
buymeacoffeeURL = _ref24.buymeacoffeeURL; | ||
// Check | ||
if (!buymeacoffeeURL) { | ||
if (!buymeacoffeeUsername) throw new Error('buymeacoffeeUsername is missing'); | ||
buymeacoffeeURL = 'https://buymeacoffee.com/' + buymeacoffeeUsername; | ||
} | ||
// Check | ||
if (!buymeacoffeeURL) { | ||
if (!buymeacoffeeUsername) throw new Error('buymeacoffeeUsername is missing'); | ||
buymeacoffeeURL = "https://buymeacoffee.com/".concat(buymeacoffeeUsername); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg'; | ||
var url = buymeacoffeeURL; | ||
var alt = 'Buy Me A Coffee donate button'; | ||
var title = 'Donate to this project using Buy Me A Coffee'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg'; | ||
var url = buymeacoffeeURL; | ||
var alt = 'Buy Me A Coffee donate button'; | ||
var title = 'Donate to this project using Buy Me A Coffee'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
buymeacoffee.badgeCategory = 'funding'; | ||
/** | ||
@@ -679,21 +788,27 @@ * Liberapay Badge | ||
*/ | ||
function liberapay(_ref25) { | ||
var liberapayUsername = _ref25.liberapayUsername, | ||
liberapayURL = _ref25.liberapayURL; | ||
var liberapayUsername = _ref25.liberapayUsername, | ||
liberapayURL = _ref25.liberapayURL; | ||
// Check | ||
if (!liberapayURL) { | ||
if (!liberapayUsername) throw new Error('liberapayUsername is missing'); | ||
liberapayURL = 'https://liberapay.com/' + liberapayUsername; | ||
} | ||
// Check | ||
if (!liberapayURL) { | ||
if (!liberapayUsername) throw new Error('liberapayUsername is missing'); | ||
liberapayURL = "https://liberapay.com/".concat(liberapayUsername); | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/liberapay-donate-yellow.svg'; | ||
var url = liberapayURL; | ||
var alt = 'Liberapay donate button'; | ||
var title = 'Donate to this project using Liberapay'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/liberapay-donate-yellow.svg'; | ||
var url = liberapayURL; | ||
var alt = 'Liberapay donate button'; | ||
var title = 'Donate to this project using Liberapay'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
liberapay.badgeCategory = 'funding'; | ||
/** | ||
@@ -709,30 +824,36 @@ * Thanks App Badge | ||
*/ | ||
function thanksapp(_ref26) { | ||
var npmPackageName = _ref26.npmPackageName, | ||
githubSlug = _ref26.githubSlug, | ||
thanksappUsername = _ref26.thanksappUsername, | ||
thanksappURL = _ref26.thanksappURL; | ||
var npmPackageName = _ref26.npmPackageName, | ||
githubSlug = _ref26.githubSlug, | ||
thanksappUsername = _ref26.thanksappUsername, | ||
thanksappURL = _ref26.thanksappURL; | ||
// Check | ||
if (!thanksappURL) { | ||
if (thanksappUsername) { | ||
thanksappURL = 'https://givethanks.app/u/' + githubSlug; | ||
} 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'); | ||
} | ||
} | ||
// Check | ||
if (!thanksappURL) { | ||
if (thanksappUsername) { | ||
thanksappURL = "https://givethanks.app/u/".concat(githubSlug); | ||
} else if (npmPackageName) { | ||
thanksappURL = "https://givethanks.app/donate/npm/".concat(npmPackageName); | ||
} else if (githubSlug) { | ||
thanksappURL = "https://givethanks.app/donate/github/".concat(githubSlug); | ||
} else { | ||
throw new Error('at least one of these is required: thanksappUsername, npmPackageName, githubSlug'); | ||
} | ||
} // Create | ||
// Create | ||
var image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg'; | ||
var url = thanksappURL; | ||
var alt = 'Thanks App donate button'; | ||
var title = 'Donate to this project using Thanks App'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg'; | ||
var url = thanksappURL; | ||
var alt = 'Thanks App donate button'; | ||
var title = 'Donate to this project using Thanks App'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
thanksapp.badgeCategory = 'funding'; | ||
/** | ||
@@ -745,18 +866,21 @@ * Boost Lab Badge | ||
*/ | ||
function boostlab(_ref27) { | ||
var githubSlug = _ref27.githubSlug; | ||
var githubSlug = _ref27.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
// Create | ||
var image = 'https://img.shields.io/badge/boostlab-donate-yellow.svg'; | ||
var url = 'https://boost-lab.app/' + githubSlug; | ||
var alt = 'Boost Lab donate button'; | ||
var title = 'Donate to this project using Boost Lab'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
var image = 'https://img.shields.io/badge/boostlab-donate-yellow.svg'; | ||
var url = "https://boost-lab.app/".concat(githubSlug); | ||
var alt = 'Boost Lab donate button'; | ||
var title = 'Donate to this project using Boost Lab'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
boostlab.badgeCategory = 'funding'; | ||
// ==================================== | ||
boostlab.badgeCategory = 'funding'; // ==================================== | ||
// Social Badges | ||
@@ -771,14 +895,13 @@ | ||
*/ | ||
function slackinscript(_ref28) { | ||
var slackinURL = _ref28.slackinURL; | ||
var slackinURL = _ref28.slackinURL; | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing'); // Create | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing'); | ||
return "<script async defer src=\"".concat(slackinURL, "/slackin.js\"></script>"); | ||
} | ||
// Create | ||
return '<script async defer src="' + slackinURL + '/slackin.js"></script>'; | ||
} | ||
slackinscript.badgeCategory = 'social'; | ||
slackinscript.badgeScript = true; | ||
/** | ||
@@ -791,17 +914,21 @@ * Slackin Badge | ||
*/ | ||
function slackin(_ref29) { | ||
var slackinURL = _ref29.slackinURL; | ||
var slackinURL = _ref29.slackinURL; | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing'); // Create | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing'); | ||
var image = "".concat(slackinURL, "/badge.svg"); | ||
var url = slackinURL; | ||
var alt = 'Slack community badge'; | ||
var title = "Join this project's slack community"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = slackinURL + '/badge.svg'; | ||
var url = slackinURL; | ||
var alt = 'Slack community badge'; | ||
var title = 'Join this project\'s slack community'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
slackin.badgeCategory = 'social'; | ||
/** | ||
@@ -816,19 +943,23 @@ * Google Analytics Beacon Badge | ||
*/ | ||
function gabeacon(_ref30) { | ||
var gaTrackingID = _ref30.gaTrackingID, | ||
githubSlug = _ref30.githubSlug; | ||
var gaTrackingID = _ref30.gaTrackingID, | ||
githubSlug = _ref30.githubSlug; | ||
// Check | ||
if (!gaTrackingID) throw new Error('gaTrackingID is missing'); | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
// Check | ||
if (!gaTrackingID) throw new Error('gaTrackingID is missing'); | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var image = "https://ga-beacon.appspot.com/".concat(gaTrackingID, "/").concat(githubSlug); | ||
var url = 'https://github.com/igrigorik/ga-beacon'; | ||
var alt = 'Google Analytics beacon image'; | ||
var title = 'Get Google Analytics for your project'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
} | ||
// Create | ||
var image = 'https://ga-beacon.appspot.com/' + gaTrackingID + '/' + githubSlug; | ||
var url = 'https://github.com/igrigorik/ga-beacon'; | ||
var alt = 'Google Analytics beacon image'; | ||
var title = 'Get Google Analytics for your project'; | ||
return badge({ image: image, alt: alt, url: url, title: title }); | ||
} | ||
gabeacon.badgeCategory = 'social'; | ||
/** | ||
@@ -841,14 +972,13 @@ * Google Plus One Button | ||
*/ | ||
function googleplusone(_ref31) { | ||
var homepage = _ref31.homepage; | ||
var homepage = _ref31.homepage; | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); // Create | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); | ||
return "<span class=\"g-plusone\" data-size=\"medium\" data-href=\"".concat(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>"); | ||
} | ||
// 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; | ||
/** | ||
@@ -861,14 +991,13 @@ * Reddit Submit Button | ||
*/ | ||
function redditsubmit(_ref32) { | ||
var homepage = _ref32.homepage; | ||
var homepage = _ref32.homepage; | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); // Create | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); | ||
return "<script>reddit_url=\"".concat(homepage, "\"</script><script src=\"https://en.reddit.com/static/button/button1.js\"></script>"); | ||
} | ||
// Create | ||
return '<script>reddit_url="' + homepage + '"</script><script src="https://en.reddit.com/static/button/button1.js"></script>'; | ||
} | ||
redditsubmit.badgeCategory = 'social'; | ||
redditsubmit.badgeScript = true; | ||
/** | ||
@@ -881,14 +1010,13 @@ * Hacker News Submit Button | ||
*/ | ||
function hackernewssubmit(_ref33) { | ||
var homepage = _ref33.homepage; | ||
var homepage = _ref33.homepage; | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); // Create | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); | ||
return "<a href=\"https://news.ycombinator.com/submit\" class=\"hn-button\" data-url=\"".concat(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>"); | ||
} | ||
// 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; | ||
/** | ||
@@ -902,17 +1030,16 @@ * Facebook Like Button | ||
*/ | ||
function facebooklike(_ref34) { | ||
var homepage = _ref34.homepage, | ||
facebookApplicationID = _ref34.facebookApplicationID; | ||
var homepage = _ref34.homepage, | ||
facebookApplicationID = _ref34.facebookApplicationID; | ||
// Prepare | ||
if (!homepage) throw new Error('homepage is missing'); | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID; | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing'); // Return | ||
// Prepare | ||
if (!homepage) throw new Error('homepage is missing'); | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID; | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing'); | ||
return "<iframe src=\"https://www.facebook.com/plugins/like.php?href=".concat(escape(homepage), "&send=false&layout=button_count&width=450&show_faces=false&font&colorscheme=light&action=like&height=21&appId=").concat(escape(facebookApplicationID), "\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height:21px;\" allowTransparency=\"true\"></iframe>"); | ||
} | ||
// Return | ||
return '<iframe src="https://www.facebook.com/plugins/like.php?href=' + escape(homepage) + '&send=false&layout=button_count&width=450&show_faces=false&font&colorscheme=light&action=like&height=21&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; | ||
/** | ||
@@ -926,17 +1053,16 @@ * Facebook Follow Button | ||
*/ | ||
function facebookfollow(_ref35) { | ||
var facebookUsername = _ref35.facebookUsername, | ||
facebookApplicationID = _ref35.facebookApplicationID; | ||
var facebookUsername = _ref35.facebookUsername, | ||
facebookApplicationID = _ref35.facebookApplicationID; | ||
// Prepare | ||
if (!facebookUsername) throw new Error('facebookUsername is missing'); | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID; | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing'); // Return | ||
// Prepare | ||
if (!facebookUsername) throw new Error('facebookUsername is missing'); | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID; | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing'); | ||
return "<iframe src=\"https://www.facebook.com/plugins/follow.php?href=https%3A%2F%2Fwww.facebook.com%2F".concat(escape(facebookUsername), "&layout=button_count&show_faces=false&colorscheme=light&font&width=450&appId=").concat(escape(facebookApplicationID), "\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height: 20px;\" allowTransparency=\"true\"></iframe>"); | ||
} | ||
// Return | ||
return '<iframe src="https://www.facebook.com/plugins/follow.php?href=https%3A%2F%2Fwww.facebook.com%2F' + escape(facebookUsername) + '&layout=button_count&show_faces=false&colorscheme=light&font&width=450&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; | ||
/** | ||
@@ -949,14 +1075,13 @@ * Twitter Tweet Button | ||
*/ | ||
function twittertweet(_ref36) { | ||
var twitterUsername = _ref36.twitterUsername; | ||
var twitterUsername = _ref36.twitterUsername; | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing'); // Return | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing'); | ||
return "<a href=\"https://twitter.com/share\" class=\"twitter-share-button\" data-via=\"".concat(twitterUsername, "\" data-related=\"").concat(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>"); | ||
} | ||
// 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; | ||
/** | ||
@@ -969,14 +1094,13 @@ * Twitter Follow Button | ||
*/ | ||
function twitterfollow(_ref37) { | ||
var twitterUsername = _ref37.twitterUsername; | ||
var twitterUsername = _ref37.twitterUsername; | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing'); // Return | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing'); | ||
return "<a href=\"https://twitter.com/".concat(escape(twitterUsername), "\" class=\"twitter-follow-button\" data-show-count=\"false\">Follow @").concat(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>"); | ||
} | ||
// 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; | ||
/** | ||
@@ -989,14 +1113,13 @@ * Github Follow Button | ||
*/ | ||
function githubfollow(_ref38) { | ||
var githubUsername = _ref38.githubUsername; | ||
var githubUsername = _ref38.githubUsername; | ||
// Prepare | ||
if (!githubUsername) throw new Error('githubUsername is missing'); // Return | ||
// Prepare | ||
if (!githubUsername) throw new Error('githubUsername is missing'); | ||
return "<iframe src=\"https://ghbtns.com/github-btn.html?user=".concat(escape(githubUsername), "&type=follow&count=true\" allowtransparency=\"true\" frameborder=\"0\" scrolling=\"0\" width=\"165\" height=\"20\"></iframe>"); | ||
} | ||
// Return | ||
return '<iframe src="https://ghbtns.com/github-btn.html?user=' + escape(githubUsername) + '&type=follow&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="165" height="20"></iframe>'; | ||
} | ||
githubfollow.badgeCategory = 'social'; | ||
githubfollow.badgeScript = true; | ||
/** | ||
@@ -1009,18 +1132,17 @@ * GitHub Star Button | ||
*/ | ||
function githubstar(_ref39) { | ||
var githubSlug = _ref39.githubSlug; | ||
var githubSlug = _ref39.githubSlug; | ||
// Prepare | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var split = githubSlug.split('/'); | ||
var githubUsername = split[0]; | ||
var githubRepository = split[1]; | ||
if (!githubUsername || !githubRepository) throw new Error('githubSlug is invalid'); // Return | ||
// Prepare | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var split = githubSlug.split('/'); | ||
var githubUsername = split[0]; | ||
var githubRepository = split[1]; | ||
if (!githubUsername || !githubRepository) throw new Error('githubSlug is invalid'); | ||
return "<iframe src=\"https://ghbtns.com/github-btn.html?user=".concat(escape(githubUsername), "&repo=").concat(escape(githubRepository), "&type=watch&count=true\" allowtransparency=\"true\" frameborder=\"0\" scrolling=\"0\" width=\"110\" height=\"20\"></iframe>"); | ||
} | ||
// Return | ||
return '<iframe src="https://ghbtns.com/github-btn.html?user=' + escape(githubUsername) + '&repo=' + escape(githubRepository) + '&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>'; | ||
} | ||
githubstar.badgeCategory = 'social'; | ||
githubstar.badgeScript = true; | ||
/** | ||
@@ -1035,61 +1157,60 @@ * Quora Follow Button | ||
*/ | ||
function quorafollow(_ref40) { | ||
var quoraUsername = _ref40.quoraUsername, | ||
quoraRealname = _ref40.quoraRealname, | ||
quoraCode = _ref40.quoraCode; | ||
var quoraUsername = _ref40.quoraUsername, | ||
quoraRealname = _ref40.quoraRealname, | ||
quoraCode = _ref40.quoraCode; | ||
// Prepare | ||
if (!quoraUsername) throw new Error('quoraUsername is missing'); | ||
quoraRealname = quoraRealname || quoraUsername.replace(/-/g, ' '); | ||
quoraCode = quoraCode || '7N31XJs'; // Return | ||
// Prepare | ||
if (!quoraUsername) throw new Error('quoraUsername is missing'); | ||
quoraRealname = quoraRealname || quoraUsername.replace(/-/g, ' '); | ||
quoraCode = quoraCode || '7N31XJs'; | ||
return "\n\t\t<span data-name=\"".concat(quoraUsername, "\">\n\t\t\tFollow <a href=\"http://www.quora.com/").concat(quoraUsername, "\">").concat(quoraRealname, "</a> on <a href=\"http://www.quora.com\">Quora</a>\n\t\t\t<script src=\"https://www.quora.com/widgets/follow?embed_code=").concat(escape(quoraCode), "\"></script>\n\t\t</span>").replace(/\n\s*/g, ''); | ||
} | ||
// Return | ||
return ('\n\t\t<span data-name="' + quoraUsername + '">\n\t\t\tFollow <a href="http://www.quora.com/' + quoraUsername + '">' + quoraRealname + '</a> on <a href="http://www.quora.com">Quora</a>\n\t\t\t<script src="https://www.quora.com/widgets/follow?embed_code=' + escape(quoraCode) + '"></script>\n\t\t</span>').replace(/\n\s*/g, ''); | ||
} | ||
quorafollow.badgeCategory = 'social'; | ||
quorafollow.badgeScript = true; | ||
quorafollow.badgeScript = true; // Export | ||
// 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 | ||
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 | ||
}; |
@@ -1,7 +0,4 @@ | ||
'use strict'; | ||
'use strict'; // Import | ||
// Import | ||
var badges = require('./badges'); | ||
var badges = require('./badges.js'); | ||
/** | ||
@@ -14,24 +11,22 @@ Render a specified badge with the appropriate wrapping (div if block badge, span if inline badge) | ||
*/ | ||
function renderBadge(badgeName) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (badgeName === '---') { | ||
return '<br class="badge-separator" />'; | ||
} | ||
if (badgeName === '---') { | ||
return '<br class="badge-separator" />'; | ||
} // Fetch | ||
// Fetch | ||
var badgeMethod = badges[badgeName]; | ||
// Send the badge value and options to the render method | ||
var badgeResult = badgeMethod(config).trim(); | ||
if (!badgeResult) return ''; | ||
var badgeMethod = badges[badgeName]; // Send the badge value and options to the render method | ||
// We have a result, so let's wrap it | ||
var elementName = badgeMethod.badgeInline === false ? 'div' : 'span'; | ||
var wrappedResult = '<' + elementName + ' class="badge-' + badgeName + '">' + badgeResult + '</' + elementName + '>'; | ||
var badgeResult = badgeMethod(config).trim(); | ||
if (!badgeResult) return ''; // We have a result, so let's wrap it | ||
// Done | ||
return wrappedResult; | ||
var elementName = badgeMethod.badgeInline === false ? 'div' : 'span'; | ||
var wrappedResult = "<".concat(elementName, " class=\"badge-").concat(badgeName, "\">").concat(badgeResult, "</").concat(elementName, ">"); // Done | ||
return wrappedResult; | ||
} | ||
/** | ||
@@ -45,54 +40,51 @@ Render specified badges with wrapping | ||
*/ | ||
function renderBadges(list) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { filterCategory: false, filterScripts: true }; | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { | ||
filterCategory: false, | ||
filterScripts: true | ||
}; | ||
// Prepare | ||
var results = []; // Render the badges | ||
// Prepare | ||
var results = []; | ||
list.forEach(function (badgeName) { | ||
var badgeConfig = config; // Custom Config? | ||
// Render the badges | ||
list.forEach(function (badgeName) { | ||
var badgeConfig = config; | ||
if (Array.isArray(badgeName)) { | ||
badgeConfig = badgeName[1]; | ||
badgeName = badgeName[0]; | ||
} // Seperator? | ||
// 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 if (badges[badgeName]) { | ||
// Category? | ||
if (options.filterCategory && options.filterCategory !== badges[badgeName].badgeCategory) return; | ||
if (badgeName === '---') { | ||
// Do not render seperators if we only wanted a single category | ||
if (options.filterCategory) return; | ||
} // Exists? | ||
else if (badges[badgeName]) { | ||
// Category? | ||
if (options.filterCategory && options.filterCategory !== badges[badgeName].badgeCategory) return; // Script? | ||
// Script? | ||
if (options.filterScripts && badges[badgeName].badgeScript) return; | ||
} | ||
// Doesn't exist | ||
else { | ||
throw new Error('the badge ' + badgeName + ' does not exist'); | ||
} | ||
if (options.filterScripts && badges[badgeName].badgeScript) return; | ||
} // Doesn't exist | ||
else { | ||
throw new Error("the badge ".concat(badgeName, " does not exist")); | ||
} // Render | ||
// Render | ||
var badgeResult = renderBadge(badgeName, badgeConfig).trim(); | ||
if (!badgeResult) return; | ||
// Rendered successfully, add the result | ||
results.push(badgeResult); | ||
}); | ||
var badgeResult = renderBadge(badgeName, badgeConfig).trim(); | ||
if (!badgeResult) return; // Rendered successfully, add the result | ||
// Return | ||
return results.join('\n'); | ||
} | ||
results.push(badgeResult); | ||
}); // Return | ||
// Export | ||
return results.join('\n'); | ||
} // Export | ||
module.exports = { | ||
badges: badges, | ||
renderBadge: renderBadge, | ||
renderBadges: renderBadges | ||
badges: badges, | ||
renderBadge: renderBadge, | ||
renderBadges: renderBadges | ||
}; |
# History | ||
## v1.2.9 2018 November 23 | ||
- Added support for `travisTLD` configuration option for the `travisci` badge | ||
- You can set it to `com` if you have migrated to travis-ci.com | ||
- Otherwise you can set it to `org` (the current default) if you are still on travis-org.com | ||
- The default will swap over once TravisCI has finished migrating all repositories to travis-ci.com | ||
- Updated [base files](https://github.com/bevry/base) using [boundation](https://github.com/bevry/boundation) | ||
## v1.2.8 2018 October 26 | ||
- Added support for `thanksappURL` and `thanksappUsername` for the `thanksapp` badge | ||
- Added support for `thanksappURL` and `thanksappUsername` for the `thanksapp` badge | ||
## v1.2.7 2018 October 26 | ||
- Added the crypto badge as a replacement for the bitcoin badge | ||
- Added the crypto badge as a replacement for the bitcoin badge | ||
## v1.2.6 2018 October 26 | ||
- Fixed the documentation params for the badges | ||
- Added the new funding badges from v1.2.5 to the readme | ||
- Fixed the documentation params for the badges | ||
- Added the new funding badges from v1.2.5 to the readme | ||
## v1.2.5 2018 October 26 | ||
- Added [Buy Me A Coffee](https://buymeacoffee.com) badge | ||
- Added [Liberapay](https://liberapay.com) badge | ||
- Added [Thanks App](https://givethanks.app) badge | ||
- Added [Boost Lab](https://boost-lab.app) badge | ||
- Updated [base files](https://github.com/bevry/base) using [boundation](https://github.com/bevry/boundation) | ||
- Added [Buy Me A Coffee](https://buymeacoffee.com) badge | ||
- Added [Liberapay](https://liberapay.com) badge | ||
- Added [Thanks App](https://givethanks.app) badge | ||
- Added [Boost Lab](https://boost-lab.app) badge | ||
- Updated [base files](https://github.com/bevry/base) using [boundation](https://github.com/bevry/boundation) | ||
## v1.2.4 2017 January 27 | ||
- meta: update docs URL to not use https | ||
- meta: update docs URL to not use https | ||
## v1.2.3 2017 January 27 | ||
- meta: recompile | ||
- meta: recompile | ||
## v1.2.2 2017 January 26 | ||
- Added [Open Collective](https://opencollective.com) badge | ||
- Added [Code Climate](https://codeclimate.com) Rating badge | ||
- Added [BitHound](https://bithound.io) Score badge | ||
- Fix the error `TypeError: Cannot read property 'badgeScript' of undefined` which appeared under certain circumstances | ||
- Added [Open Collective](https://opencollective.com) badge | ||
- Added [Code Climate](https://codeclimate.com) Rating badge | ||
- Added [BitHound](https://bithound.io) Score badge | ||
- Fix the error `TypeError: Cannot read property 'badgeScript' of undefined` which appeared under certain circumstances | ||
## v1.2.1 2016 September 19 | ||
- Added `nodeico` badge | ||
- Thanks to [Richard Walker](https://github.com/digitalsadhu) for [pull request #5](https://github.com/bevry/badges/pull/5) which closes [issue #2](https://github.com/bevry/badges/issues/2) | ||
- Added `nodeico` badge | ||
- Thanks to [Richard Walker](https://github.com/digitalsadhu) for [pull request #5](https://github.com/bevry/badges/pull/5) which closes [issue #2](https://github.com/bevry/badges/issues/2) | ||
## v1.2.0 2016 May 27 | ||
- Updated internal conventions | ||
- Moved from [ESNextGuardian](https://github.com/bevry/esnextguardian) to [Editions](https://github.com/bevry/editions) | ||
- Updated internal conventions | ||
- Moved from [ESNextGuardian](https://github.com/bevry/esnextguardian) to [Editions](https://github.com/bevry/editions) | ||
## v1.1.2 2016 January 14 | ||
- Repackaged | ||
- [This release was live coded. You can watch it here.](https://plus.google.com/u/0/b/100631142988286661025/events/c9k1pidfui89hfa39cr5831dmi8) | ||
- Repackaged | ||
- [This release was live coded. You can watch it here.](https://plus.google.com/u/0/b/100631142988286661025/events/c9k1pidfui89hfa39cr5831dmi8) | ||
## v1.1.1 2016 January 14 | ||
- Added `flattrUsername` and `flattrURL` for new flattr system | ||
- Added `sixtydevstipsURL`, `patreonURL`, and `gratipayURL` for consistency | ||
- [This release was live coded. You can watch it here.](https://plus.google.com/u/0/b/100631142988286661025/events/c9k1pidfui89hfa39cr5831dmi8) | ||
- Added `flattrUsername` and `flattrURL` for new flattr system | ||
- Added `sixtydevstipsURL`, `patreonURL`, and `gratipayURL` for consistency | ||
- [This release was live coded. You can watch it here.](https://plus.google.com/u/0/b/100631142988286661025/events/c9k1pidfui89hfa39cr5831dmi8) | ||
## v1.1.0 2015 December 9 | ||
- Updated internal conventions | ||
- Updated internal conventions | ||
## v1.0.2 2015 September 18 | ||
- Added `60devstips` badge for https://tips.60devs.com | ||
- We now use the [esnextguardian](https://github.com/bevry/esnextguardian) package, instead of just bundling it | ||
- Added `60devstips` badge for https://tips.60devs.com | ||
- We now use the [esnextguardian](https://github.com/bevry/esnextguardian) package, instead of just bundling it | ||
## v1.0.1 2015 September 16 | ||
- Always use https | ||
- Always use https | ||
## v1.0.0 2015 September 16 | ||
- Initial working release | ||
- Consolidated badges from: | ||
- [projectz](https://github.com/bevry/projectz) | ||
- [docpad-plugin-services](https://github.com/docpad/docpad-plugin-services) | ||
- Initial working release | ||
- Consolidated badges from: - [projectz](https://github.com/bevry/projectz) - [docpad-plugin-services](https://github.com/docpad/docpad-plugin-services) |
117
package.json
{ | ||
"name": "badges", | ||
"version": "1.2.8", | ||
"version": "1.2.9", | ||
"description": "The definitive collection of badges for rendering", | ||
@@ -83,19 +83,19 @@ "homepage": "https://github.com/bevry/badges", | ||
"flattr", | ||
"liberapay", | ||
"thanksapp", | ||
"boostlab", | ||
"buymeacoffee", | ||
"opencollective", | ||
"buymeacoffee", | ||
"liberapay", | ||
"crypto", | ||
"paypal", | ||
"bitcoin", | ||
"wishlist" | ||
], | ||
"config": { | ||
"patreonUsername": "bevry", | ||
"buymeacoffeeUsername": "balupton", | ||
"liberapayUsername": "balupton", | ||
"cryptoURL": "https://bevry.me/crypto", | ||
"flattrUsername": "balupton", | ||
"liberapayUsername": "bevry", | ||
"opencollectiveUsername": "bevry", | ||
"flattrUsername": "balupton", | ||
"patreonUsername": "bevry", | ||
"paypalURL": "https://bevry.me/paypal", | ||
"bitcoinURL": "https://bevry.me/bitcoin", | ||
"wishlistURL": "https://bevry.me/wishlist" | ||
@@ -127,11 +127,11 @@ } | ||
"entry": "index.js", | ||
"syntaxes": [ | ||
"engines": { | ||
"node": "6 || 8 || 10 || 11", | ||
"browsers": false | ||
}, | ||
"tags": [ | ||
"javascript", | ||
"esnext", | ||
"require" | ||
], | ||
"engines": { | ||
"node": ">=6", | ||
"browsers": false | ||
} | ||
] | ||
}, | ||
@@ -142,23 +142,10 @@ { | ||
"entry": "index.js", | ||
"syntaxes": [ | ||
"javascript", | ||
"require" | ||
], | ||
"engines": { | ||
"node": false, | ||
"browsers": "defaults" | ||
} | ||
}, | ||
{ | ||
"description": "esnext compiled for node.js >=11 with require for modules", | ||
"directory": "edition-node-11", | ||
"entry": "index.js", | ||
"syntaxes": [ | ||
}, | ||
"tags": [ | ||
"javascript", | ||
"require" | ||
], | ||
"engines": { | ||
"node": "6 || 8 || 10 || 11", | ||
"browsers": false | ||
} | ||
] | ||
}, | ||
@@ -169,10 +156,10 @@ { | ||
"entry": "index.js", | ||
"syntaxes": [ | ||
"engines": { | ||
"node": "0.8 || 0.10 || 0.12 || 4 || 6 || 8 || 10 || 11", | ||
"browsers": false | ||
}, | ||
"tags": [ | ||
"javascript", | ||
"require" | ||
], | ||
"engines": { | ||
"node": "0.8 || 0.10 || 0.12 || 4 || 6 || 8 || 10", | ||
"browsers": false | ||
} | ||
] | ||
} | ||
@@ -183,26 +170,31 @@ ], | ||
"dependencies": { | ||
"editions": "^2.0.2" | ||
"editions": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.1.5", | ||
"@babel/core": "^7.1.6", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0", | ||
"@babel/preset-env": "^7.1.6", | ||
"assert-helpers": "^4.5.1", | ||
"babel-cli": "^6.26.0", | ||
"babel-preset-env": "^1.7.0", | ||
"documentation": "^8.1.2", | ||
"eslint": "^5.7.0", | ||
"eslint": "^5.9.0", | ||
"eslint-config-bevry": "^1.0.1", | ||
"eslint-config-prettier": "^3.3.0", | ||
"eslint-plugin-prettier": "^3.0.0", | ||
"joe": "^2.0.2", | ||
"joe-reporter-console": "^2.0.2", | ||
"projectz": "^1.4.0", | ||
"jsdoc": "^3.5.5", | ||
"minami": "^1.2.3", | ||
"prettier": "^1.15.2", | ||
"projectz": "^1.5.3", | ||
"surge": "^0.20.1", | ||
"valid-directory": "^1.0.0" | ||
}, | ||
"optionalDependencies": {}, | ||
"scripts": { | ||
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out", | ||
"our:compile": "npm run our:compile:edition-browsers && npm run our:compile:edition-node-0.8 && npm run our:compile:edition-node-11", | ||
"our:compile": "npm run our:compile:edition-browsers && npm run our:compile:edition-node-0.8", | ||
"our:compile:edition-browsers": "env BABEL_ENV=edition-browsers babel --out-dir ./edition-browsers ./source", | ||
"our:compile:edition-node-0.8": "env BABEL_ENV=edition-node-0.8 babel --out-dir ./edition-node-0.8 ./source", | ||
"our:compile:edition-node-11": "env BABEL_ENV=edition-node-11 babel --out-dir ./edition-node-11 ./source", | ||
"our:deploy": "echo no need for this project", | ||
"our:meta": "npm run our:meta:docs && npm run our:meta:projectz", | ||
"our:meta:docs": "documentation build -f html -o ./docs -g --shallow ./source/**.js", | ||
"our:meta:docs": "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:projectz": "projectz compile", | ||
@@ -220,3 +212,3 @@ "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:verify:directory": "npx valid-directory", | ||
"our:verify:eslint": "eslint --fix ./source", | ||
"our:verify:eslint": "eslint --fix --ignore-pattern '**/*.d.ts' './source/**'", | ||
"test": "node --harmony ./test.js --joe-reporter=console" | ||
@@ -229,3 +221,3 @@ }, | ||
[ | ||
"env", | ||
"@babel/preset-env", | ||
{ | ||
@@ -237,20 +229,11 @@ "targets": { | ||
] | ||
], | ||
"plugins": [ | ||
"@babel/proposal-object-rest-spread" | ||
] | ||
}, | ||
"edition-node-11": { | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"targets": { | ||
"node": "11" | ||
} | ||
} | ||
] | ||
] | ||
}, | ||
"edition-node-0.8": { | ||
"presets": [ | ||
[ | ||
"env", | ||
"@babel/preset-env", | ||
{ | ||
@@ -262,6 +245,18 @@ "targets": { | ||
] | ||
], | ||
"plugins": [ | ||
"@babel/proposal-object-rest-spread" | ||
] | ||
} | ||
} | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"bevry" | ||
] | ||
}, | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": true | ||
} | ||
} |
@@ -18,9 +18,9 @@ <!-- TITLE/ --> | ||
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span> | ||
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span> | ||
<span class="badge-thanksapp"><a href="https://givethanks.app/donate/npm/badges" title="Donate to this project using Thanks App"><img src="https://img.shields.io/badge/thanksapp-donate-yellow.svg" alt="Thanks App donate button" /></a></span> | ||
<span class="badge-boostlab"><a href="https://boost-lab.app/bevry/badges" title="Donate to this project using Boost Lab"><img src="https://img.shields.io/badge/boostlab-donate-yellow.svg" alt="Boost Lab donate button" /></a></span> | ||
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span> | ||
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span> | ||
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span> | ||
<span class="badge-liberapay"><a href="https://liberapay.com/balupton" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span> | ||
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span> | ||
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span> | ||
<span class="badge-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin donate button" /></a></span> | ||
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span> | ||
@@ -49,3 +49,3 @@ | ||
<li>Module: <code>require('badges')</code></li> | ||
<li>CDN URL: <code>//wzrd.in/bundle/badges@1.2.8</code></li></ul> | ||
<li>CDN URL: <code>//wzrd.in/bundle/badges@1.2.9</code></li></ul> | ||
@@ -63,3 +63,2 @@ <a href="http://enderjs.com" title="Ender is a full featured package manager for your browser"><h3>Ender</h3></a><ul> | ||
<li><code>badges/edition-browsers/index.js</code> is esnext compiled for browsers with require for modules</li> | ||
<li><code>badges/edition-node-11/index.js</code> is esnext compiled for node.js >=11 with require for modules</li> | ||
<li><code>badges/edition-node-0.8/index.js</code> is esnext compiled for node.js >=0.8 with require for modules</li></ul> | ||
@@ -230,9 +229,9 @@ | ||
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span> | ||
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span> | ||
<span class="badge-thanksapp"><a href="https://givethanks.app/donate/npm/badges" title="Donate to this project using Thanks App"><img src="https://img.shields.io/badge/thanksapp-donate-yellow.svg" alt="Thanks App donate button" /></a></span> | ||
<span class="badge-boostlab"><a href="https://boost-lab.app/bevry/badges" title="Donate to this project using Boost Lab"><img src="https://img.shields.io/badge/boostlab-donate-yellow.svg" alt="Boost Lab donate button" /></a></span> | ||
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span> | ||
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span> | ||
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span> | ||
<span class="badge-liberapay"><a href="https://liberapay.com/balupton" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span> | ||
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span> | ||
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span> | ||
<span class="badge-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin donate button" /></a></span> | ||
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span> | ||
@@ -239,0 +238,0 @@ |
@@ -20,3 +20,3 @@ 'use strict' | ||
*/ | ||
function badge ({ image, alt, url, title }) { | ||
function badge({ image, alt, url, title }) { | ||
// Check | ||
@@ -26,5 +26,10 @@ if (!image) throw new Error('image is missing') | ||
// Create | ||
let result = alt ? `<img src="${image}" alt="${alt}" />` : `<img src="${image}" />` | ||
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>' | ||
result = | ||
(title ? `<a href="${url}" title="${title}">` : `<a href="${url}">`) + | ||
result + | ||
'</a>' | ||
} | ||
@@ -47,3 +52,3 @@ return result | ||
*/ | ||
function shields ({ left, right, color = 'yellow', alt, url, title }) { | ||
function shields({ left, right, color = 'yellow', alt, url, title }) { | ||
// Check | ||
@@ -59,3 +64,2 @@ if (!left) throw new Error('left is missing') | ||
// ==================================== | ||
@@ -71,3 +75,3 @@ // Development Badges | ||
*/ | ||
function npmversion ({ npmPackageName }) { | ||
function npmversion({ npmPackageName }) { | ||
// Check | ||
@@ -92,3 +96,3 @@ if (!npmPackageName) throw new Error('npmPackageName is missing') | ||
*/ | ||
function npmdownloads ({ npmPackageName }) { | ||
function npmdownloads({ npmPackageName }) { | ||
// Check | ||
@@ -112,3 +116,3 @@ if (!npmPackageName) throw new Error('npmPackageName is missing') | ||
*/ | ||
function daviddm ({ githubSlug }) { | ||
function daviddm({ githubSlug }) { | ||
// Check | ||
@@ -133,3 +137,3 @@ if (!githubSlug) throw new Error('githubSlug is missing') | ||
*/ | ||
function daviddmdev ({ githubSlug }) { | ||
function daviddmdev({ githubSlug }) { | ||
// Check | ||
@@ -142,3 +146,4 @@ if (!githubSlug) throw new Error('githubSlug is missing') | ||
const alt = 'Dev Dependency Status' | ||
const title = "View the status of this project's development dependencies on DavidDM" | ||
const title = | ||
"View the status of this project's development dependencies on DavidDM" | ||
return badge({ image, alt, url, title }) | ||
@@ -158,6 +163,10 @@ } | ||
*/ | ||
function nodeico ({ npmPackageName, nodeicoQueryString }) { | ||
function nodeico({ npmPackageName, nodeicoQueryString }) { | ||
// Prepare | ||
if (!npmPackageName) throw new Error('npmPackageName is missing') | ||
if (nodeicoQueryString && typeof nodeicoQueryString !== 'string' && typeof nodeicoQueryString !== 'object') { | ||
if ( | ||
nodeicoQueryString && | ||
typeof nodeicoQueryString !== 'string' && | ||
typeof nodeicoQueryString !== 'object' | ||
) { | ||
throw new Error('nodeicoQueryString must be a string or an object') | ||
@@ -171,3 +180,6 @@ } | ||
let image = `https://nodei.co/npm/${npmPackageName}.png` | ||
const query = (typeof nodeicoQueryString === 'object') ? querystring.stringify(nodeicoQueryString) : nodeicoQueryString | ||
const query = | ||
typeof nodeicoQueryString === 'object' | ||
? querystring.stringify(nodeicoQueryString) | ||
: nodeicoQueryString | ||
if (query) image += `?${query}` | ||
@@ -178,3 +190,2 @@ return badge({ image, alt, url, title }) | ||
// ==================================== | ||
@@ -190,3 +201,3 @@ // Testing Badges | ||
*/ | ||
function saucelabsbm ({ saucelabsUsername, saucelabsAuthToken }) { | ||
function saucelabsbm({ saucelabsUsername, saucelabsAuthToken }) { | ||
// Check | ||
@@ -198,3 +209,5 @@ if (!saucelabsUsername) throw new Error('saucelabsUsername is missing') | ||
// Create | ||
const image = `https://saucelabs.com/browser-matrix/${saucelabsUsername}.svg?auth=${escape(saucelabsAuthToken)}` | ||
const image = `https://saucelabs.com/browser-matrix/${saucelabsUsername}.svg?auth=${escape( | ||
saucelabsAuthToken | ||
)}` | ||
const url = `https://saucelabs.com/u/${saucelabsUsername}` | ||
@@ -216,3 +229,3 @@ const alt = 'Sauce Labs Browser Matrix' | ||
*/ | ||
function saucelabs ({ saucelabsUsername, saucelabsAuthToken }) { | ||
function saucelabs({ saucelabsUsername, saucelabsAuthToken }) { | ||
// Check | ||
@@ -224,3 +237,5 @@ if (!saucelabsUsername) throw new Error('saucelabsUsername is missing') | ||
// Create | ||
const image = `https://saucelabs.com/browser-matrix/${saucelabsUsername}.svg?auth=${escape(saucelabsAuthToken)}` | ||
const image = `https://saucelabs.com/browser-matrix/${saucelabsUsername}.svg?auth=${escape( | ||
saucelabsAuthToken | ||
)}` | ||
const url = `https://saucelabs.com/u/${saucelabsUsername}` | ||
@@ -238,5 +253,6 @@ const alt = 'Sauce Labs Browser Matrix' | ||
* @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 | ||
*/ | ||
function travisci ({ githubSlug }) { | ||
function travisci({ githubSlug, travisTLD = 'org' }) { | ||
// Check | ||
@@ -246,4 +262,11 @@ if (!githubSlug) throw new Error('githubSlug is missing') | ||
// Create | ||
const image = `https://img.shields.io/travis/${githubSlug}/master.svg` | ||
const url = `http://travis-ci.org/${githubSlug}` | ||
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' | ||
@@ -263,3 +286,3 @@ const title = "Check this project's build status on TravisCI" | ||
*/ | ||
function codeship ({ codeshipProjectUUID, codeshipProjectID }) { | ||
function codeship({ codeshipProjectUUID, codeshipProjectID }) { | ||
// Check | ||
@@ -285,3 +308,3 @@ if (!codeshipProjectUUID) throw new Error('codeshipProjectUUID is missing') | ||
*/ | ||
function coveralls ({ githubSlug }) { | ||
function coveralls({ githubSlug }) { | ||
// Check | ||
@@ -306,3 +329,3 @@ if (!githubSlug) throw new Error('githubSlug is missing') | ||
*/ | ||
function codeclimate ({ githubSlug }) { | ||
function codeclimate({ githubSlug }) { | ||
// Check | ||
@@ -327,3 +350,3 @@ if (!githubSlug) throw new Error('githubSlug is missing') | ||
*/ | ||
function bithound ({ githubSlug }) { | ||
function bithound({ githubSlug }) { | ||
// Check | ||
@@ -348,3 +371,3 @@ if (!githubSlug) throw new Error('githubSlug is missing') | ||
*/ | ||
function waffle ({ githubSlug }) { | ||
function waffle({ githubSlug }) { | ||
// Check | ||
@@ -355,3 +378,5 @@ if (!githubSlug) throw new Error('githubSlug is missing') | ||
const label = 'ready' | ||
const image = `https://badge.waffle.io/${githubSlug}.png?label=${escape(label)}` | ||
const image = `https://badge.waffle.io/${githubSlug}.png?label=${escape( | ||
label | ||
)}` | ||
const url = `http://waffle.io/${githubSlug}` | ||
@@ -364,3 +389,2 @@ const alt = 'Stories in Ready' | ||
// ==================================== | ||
@@ -377,3 +401,3 @@ // Funding Badges | ||
*/ | ||
function sixtydevstips ({ sixtydevstipsID, sixtydevstipsURL }) { | ||
function sixtydevstips({ sixtydevstipsID, sixtydevstipsURL }) { | ||
// Check | ||
@@ -402,3 +426,3 @@ if (!sixtydevstipsURL) { | ||
*/ | ||
function patreon ({ patreonUsername, patreonURL }) { | ||
function patreon({ patreonUsername, patreonURL }) { | ||
// Check | ||
@@ -427,6 +451,7 @@ if (!patreonURL) { | ||
*/ | ||
function opencollective ({ opencollectiveUsername, opencollectiveURL }) { | ||
function opencollective({ opencollectiveUsername, opencollectiveURL }) { | ||
// Check | ||
if (!opencollectiveURL) { | ||
if (!opencollectiveUsername) throw new Error('opencollectiveUsername is missing') | ||
if (!opencollectiveUsername) | ||
throw new Error('opencollectiveUsername is missing') | ||
opencollectiveURL = `https://opencollective.com/${opencollectiveUsername}` | ||
@@ -436,3 +461,4 @@ } | ||
// Create | ||
const image = 'https://img.shields.io/badge/open%20collective-donate-yellow.svg' | ||
const image = | ||
'https://img.shields.io/badge/open%20collective-donate-yellow.svg' | ||
const url = opencollectiveURL | ||
@@ -453,3 +479,3 @@ const alt = 'Open Collective donate button' | ||
*/ | ||
function gratipay ({ gratipayUsername, gratipayURL }) { | ||
function gratipay({ gratipayUsername, gratipayURL }) { | ||
// Check | ||
@@ -479,3 +505,3 @@ if (!gratipayURL) { | ||
*/ | ||
function flattr ({ flattrCode, flattrUsername, flattrURL }) { | ||
function flattr({ flattrCode, flattrUsername, flattrURL }) { | ||
// Check | ||
@@ -485,7 +511,5 @@ if (!flattrURL) { | ||
flattrURL = `https://flattr.com/profile/${flattrUsername}` | ||
} | ||
else if (flattrCode) { | ||
} else if (flattrCode) { | ||
flattrURL = `https://flattr.com/thing/${flattrCode}` | ||
} | ||
else { | ||
} else { | ||
throw new Error('flattrUsername/flattrCode is missing') | ||
@@ -513,14 +537,16 @@ } | ||
*/ | ||
function paypal ({ paypalURL, paypalButtonID, paypalUsername }) { | ||
function paypal({ paypalURL, paypalButtonID, paypalUsername }) { | ||
// Check | ||
if (!paypalURL) { | ||
if (paypalButtonID) { | ||
paypalURL = `https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=${escape(paypalButtonID)}` | ||
} | ||
else if (paypalUsername) { | ||
paypalURL = `https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&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' | ||
) | ||
} | ||
else { | ||
throw new Error('paypalURL, paypalButtonID, or paypalUsername is missing, at least one must exist') | ||
} | ||
} | ||
@@ -544,3 +570,3 @@ | ||
*/ | ||
function crypto ({ cryptoURL, bitcoinURL }) { | ||
function crypto({ cryptoURL, bitcoinURL }) { | ||
// Check | ||
@@ -564,3 +590,3 @@ const url = cryptoURL || bitcoinURL | ||
*/ | ||
function bitcoin (opts) { | ||
function bitcoin(opts) { | ||
return crypto(opts) | ||
@@ -577,3 +603,3 @@ } | ||
*/ | ||
function wishlist ({ wishlistURL }) { | ||
function wishlist({ wishlistURL }) { | ||
// Check | ||
@@ -599,6 +625,7 @@ if (!wishlistURL) throw new Error('wishlistURL is missing') | ||
*/ | ||
function buymeacoffee ({ buymeacoffeeUsername, buymeacoffeeURL }) { | ||
function buymeacoffee({ buymeacoffeeUsername, buymeacoffeeURL }) { | ||
// Check | ||
if (!buymeacoffeeURL) { | ||
if (!buymeacoffeeUsername) throw new Error('buymeacoffeeUsername is missing') | ||
if (!buymeacoffeeUsername) | ||
throw new Error('buymeacoffeeUsername is missing') | ||
buymeacoffeeURL = `https://buymeacoffee.com/${buymeacoffeeUsername}` | ||
@@ -608,3 +635,4 @@ } | ||
// Create | ||
const image = 'https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg' | ||
const image = | ||
'https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg' | ||
const url = buymeacoffeeURL | ||
@@ -625,3 +653,3 @@ const alt = 'Buy Me A Coffee donate button' | ||
*/ | ||
function liberapay ({ liberapayUsername, liberapayURL }) { | ||
function liberapay({ liberapayUsername, liberapayURL }) { | ||
// Check | ||
@@ -652,3 +680,8 @@ if (!liberapayURL) { | ||
*/ | ||
function thanksapp ({ npmPackageName, githubSlug, thanksappUsername, thanksappURL }) { | ||
function thanksapp({ | ||
npmPackageName, | ||
githubSlug, | ||
thanksappUsername, | ||
thanksappURL | ||
}) { | ||
// Check | ||
@@ -658,12 +691,11 @@ if (!thanksappURL) { | ||
thanksappURL = `https://givethanks.app/u/${githubSlug}` | ||
} | ||
else if (npmPackageName) { | ||
} else if (npmPackageName) { | ||
thanksappURL = `https://givethanks.app/donate/npm/${npmPackageName}` | ||
} | ||
else if (githubSlug) { | ||
} else if (githubSlug) { | ||
thanksappURL = `https://givethanks.app/donate/github/${githubSlug}` | ||
} else { | ||
throw new Error( | ||
'at least one of these is required: thanksappUsername, npmPackageName, githubSlug' | ||
) | ||
} | ||
else { | ||
throw new Error('at least one of these is required: thanksappUsername, npmPackageName, githubSlug') | ||
} | ||
} | ||
@@ -687,3 +719,3 @@ | ||
*/ | ||
function boostlab ({ githubSlug }) { | ||
function boostlab({ githubSlug }) { | ||
// Check | ||
@@ -701,3 +733,2 @@ if (!githubSlug) throw new Error('githubSlug is missing') | ||
// ==================================== | ||
@@ -713,3 +744,3 @@ // Social Badges | ||
*/ | ||
function slackinscript ({ slackinURL }) { | ||
function slackinscript({ slackinURL }) { | ||
// Check | ||
@@ -731,3 +762,3 @@ if (!slackinURL) throw new Error('slackinURL is missing') | ||
*/ | ||
function slackin ({ slackinURL }) { | ||
function slackin({ slackinURL }) { | ||
// Check | ||
@@ -740,3 +771,3 @@ if (!slackinURL) throw new Error('slackinURL is missing') | ||
const alt = 'Slack community badge' | ||
const title = 'Join this project\'s slack community' | ||
const title = "Join this project's slack community" | ||
return badge({ image, alt, url, title }) | ||
@@ -755,3 +786,3 @@ } | ||
*/ | ||
function gabeacon ({ gaTrackingID, githubSlug }) { | ||
function gabeacon({ gaTrackingID, githubSlug }) { | ||
// Check | ||
@@ -777,3 +808,3 @@ if (!gaTrackingID) throw new Error('gaTrackingID is missing') | ||
*/ | ||
function googleplusone ({ homepage }) { | ||
function googleplusone({ homepage }) { | ||
// Check | ||
@@ -795,3 +826,3 @@ if (!homepage) throw new Error('homepage is missing') | ||
*/ | ||
function redditsubmit ({ homepage }) { | ||
function redditsubmit({ homepage }) { | ||
// Check | ||
@@ -813,3 +844,3 @@ if (!homepage) throw new Error('homepage is missing') | ||
*/ | ||
function hackernewssubmit ({ homepage }) { | ||
function hackernewssubmit({ homepage }) { | ||
// Check | ||
@@ -832,10 +863,16 @@ if (!homepage) throw new Error('homepage is missing') | ||
*/ | ||
function facebooklike ({ homepage, facebookApplicationID }) { | ||
function facebooklike({ homepage, facebookApplicationID }) { | ||
// Prepare | ||
if (!homepage) throw new Error('homepage is missing') | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing') | ||
facebookApplicationID = | ||
facebookApplicationID || process.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)}&send=false&layout=button_count&width=450&show_faces=false&font&colorscheme=light&action=like&height=21&appId=${escape(facebookApplicationID)}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>` | ||
return `<iframe src="https://www.facebook.com/plugins/like.php?href=${escape( | ||
homepage | ||
)}&send=false&layout=button_count&width=450&show_faces=false&font&colorscheme=light&action=like&height=21&appId=${escape( | ||
facebookApplicationID | ||
)}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>` | ||
} | ||
@@ -853,10 +890,16 @@ facebooklike.badgeCategory = 'social' | ||
*/ | ||
function facebookfollow ({ facebookUsername, facebookApplicationID }) { | ||
function facebookfollow({ facebookUsername, facebookApplicationID }) { | ||
// Prepare | ||
if (!facebookUsername) throw new Error('facebookUsername is missing') | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing') | ||
facebookApplicationID = | ||
facebookApplicationID || process.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)}&layout=button_count&show_faces=false&colorscheme=light&font&width=450&appId=${escape(facebookApplicationID)}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height: 20px;" allowTransparency="true"></iframe>` | ||
return `<iframe src="https://www.facebook.com/plugins/follow.php?href=https%3A%2F%2Fwww.facebook.com%2F${escape( | ||
facebookUsername | ||
)}&layout=button_count&show_faces=false&colorscheme=light&font&width=450&appId=${escape( | ||
facebookApplicationID | ||
)}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height: 20px;" allowTransparency="true"></iframe>` | ||
} | ||
@@ -873,3 +916,3 @@ facebookfollow.badgeCategory = 'social' | ||
*/ | ||
function twittertweet ({ twitterUsername }) { | ||
function twittertweet({ twitterUsername }) { | ||
// Prepare | ||
@@ -891,3 +934,3 @@ if (!twitterUsername) throw new Error('twitterUsername is missing') | ||
*/ | ||
function twitterfollow ({ twitterUsername }) { | ||
function twitterfollow({ twitterUsername }) { | ||
// Prepare | ||
@@ -897,3 +940,5 @@ 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>` | ||
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>` | ||
} | ||
@@ -910,3 +955,3 @@ twitterfollow.badgeCategory = 'social' | ||
*/ | ||
function githubfollow ({ githubUsername }) { | ||
function githubfollow({ githubUsername }) { | ||
// Prepare | ||
@@ -916,3 +961,5 @@ if (!githubUsername) throw new Error('githubUsername is missing') | ||
// Return | ||
return `<iframe src="https://ghbtns.com/github-btn.html?user=${escape(githubUsername)}&type=follow&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="165" height="20"></iframe>` | ||
return `<iframe src="https://ghbtns.com/github-btn.html?user=${escape( | ||
githubUsername | ||
)}&type=follow&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="165" height="20"></iframe>` | ||
} | ||
@@ -929,3 +976,3 @@ githubfollow.badgeCategory = 'social' | ||
*/ | ||
function githubstar ({ githubSlug }) { | ||
function githubstar({ githubSlug }) { | ||
// Prepare | ||
@@ -936,6 +983,11 @@ if (!githubSlug) throw new Error('githubSlug is missing') | ||
const githubRepository = split[1] | ||
if (!githubUsername || !githubRepository) throw new Error('githubSlug is invalid') | ||
if (!githubUsername || !githubRepository) | ||
throw new Error('githubSlug is invalid') | ||
// Return | ||
return `<iframe src="https://ghbtns.com/github-btn.html?user=${escape(githubUsername)}&repo=${escape(githubRepository)}&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>` | ||
return `<iframe src="https://ghbtns.com/github-btn.html?user=${escape( | ||
githubUsername | ||
)}&repo=${escape( | ||
githubRepository | ||
)}&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>` | ||
} | ||
@@ -954,3 +1006,3 @@ githubstar.badgeCategory = 'social' | ||
*/ | ||
function quorafollow ({ quoraUsername, quoraRealname, quoraCode }) { | ||
function quorafollow({ quoraUsername, quoraRealname, quoraCode }) { | ||
// Prepare | ||
@@ -965,3 +1017,5 @@ if (!quoraUsername) throw new Error('quoraUsername is missing') | ||
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> | ||
<script src="https://www.quora.com/widgets/follow?embed_code=${escape( | ||
quoraCode | ||
)}"></script> | ||
</span>`.replace(/\n\s*/g, '') | ||
@@ -968,0 +1022,0 @@ } |
'use strict' | ||
// Import | ||
const badges = require('./badges') | ||
const badges = require('./badges.js') | ||
@@ -13,4 +13,4 @@ /** | ||
*/ | ||
function renderBadge (badgeName, config = {}) { | ||
if ( badgeName === '---' ) { | ||
function renderBadge(badgeName, config = {}) { | ||
if (badgeName === '---') { | ||
return '<br class="badge-separator" />' | ||
@@ -24,3 +24,3 @@ } | ||
const badgeResult = badgeMethod(config).trim() | ||
if ( !badgeResult ) return '' | ||
if (!badgeResult) return '' | ||
@@ -43,3 +43,7 @@ // We have a result, so let's wrap it | ||
*/ | ||
function renderBadges (list, config = {}, options = {filterCategory: false, filterScripts: true}) { | ||
function renderBadges( | ||
list, | ||
config = {}, | ||
options = { filterCategory: false, filterScripts: true } | ||
) { | ||
// Prepare | ||
@@ -49,7 +53,7 @@ const results = [] | ||
// Render the badges | ||
list.forEach(function (badgeName) { | ||
list.forEach(function(badgeName) { | ||
let badgeConfig = config | ||
// Custom Config? | ||
if ( Array.isArray(badgeName) ) { | ||
if (Array.isArray(badgeName)) { | ||
badgeConfig = badgeName[1] | ||
@@ -60,13 +64,17 @@ badgeName = badgeName[0] | ||
// Seperator? | ||
if ( badgeName === '---' ) { | ||
if (badgeName === '---') { | ||
// Do not render seperators if we only wanted a single category | ||
if ( options.filterCategory ) return | ||
if (options.filterCategory) return | ||
} | ||
// Exists? | ||
else if ( badges[badgeName] ) { | ||
else if (badges[badgeName]) { | ||
// Category? | ||
if ( options.filterCategory && options.filterCategory !== badges[badgeName].badgeCategory ) return | ||
if ( | ||
options.filterCategory && | ||
options.filterCategory !== badges[badgeName].badgeCategory | ||
) | ||
return | ||
// Script? | ||
if ( options.filterScripts && badges[badgeName].badgeScript ) return | ||
if (options.filterScripts && badges[badgeName].badgeScript) return | ||
} | ||
@@ -80,3 +88,3 @@ // Doesn't exist | ||
const badgeResult = renderBadge(badgeName, badgeConfig).trim() | ||
if ( !badgeResult ) return | ||
if (!badgeResult) return | ||
@@ -83,0 +91,0 @@ // Rendered successfully, add the result |
12
142272
17
11
3205
260
Updatededitions@^2.1.0