Comparing version 1.2.7 to 1.2.8
@@ -677,17 +677,30 @@ 'use strict'; | ||
* @param {Object} opts | ||
* @param {string} opts.npmPackageName The repository slug (username/reponame) | ||
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges) | ||
* @param {string} opts.npmPackageName The repository slug (username/reponame) | ||
* @param {string} opts.thanksappUsername The username for the Thanks App donate page | ||
* @param {string} opts.thanksappURL The url to the Thanks App donate page | ||
* @return {string} the result badge | ||
*/ | ||
function thanksapp(_ref26) { | ||
var githubSlug = _ref26.githubSlug, | ||
npmPackageName = _ref26.npmPackageName; | ||
var npmPackageName = _ref26.npmPackageName, | ||
githubSlug = _ref26.githubSlug, | ||
thanksappUsername = _ref26.thanksappUsername, | ||
thanksappURL = _ref26.thanksappURL; | ||
// Check | ||
if (!githubSlug && !npmPackageName) throw new Error('githubSlug and npmPackageName are missing, at least one is required'); | ||
var slug = npmPackageName ? 'npm/' + npmPackageName : 'github/' + githubSlug; | ||
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'); | ||
} | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg'; | ||
var url = 'https://givethanks.app/donate/' + slug; | ||
var url = thanksappURL; | ||
var alt = 'Thanks App donate button'; | ||
@@ -694,0 +707,0 @@ var title = 'Donate to this project using Thanks App'; |
@@ -677,17 +677,30 @@ 'use strict'; | ||
* @param {Object} opts | ||
* @param {string} opts.npmPackageName The repository slug (username/reponame) | ||
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges) | ||
* @param {string} opts.npmPackageName The repository slug (username/reponame) | ||
* @param {string} opts.thanksappUsername The username for the Thanks App donate page | ||
* @param {string} opts.thanksappURL The url to the Thanks App donate page | ||
* @return {string} the result badge | ||
*/ | ||
function thanksapp(_ref26) { | ||
var githubSlug = _ref26.githubSlug, | ||
npmPackageName = _ref26.npmPackageName; | ||
var npmPackageName = _ref26.npmPackageName, | ||
githubSlug = _ref26.githubSlug, | ||
thanksappUsername = _ref26.thanksappUsername, | ||
thanksappURL = _ref26.thanksappURL; | ||
// Check | ||
if (!githubSlug && !npmPackageName) throw new Error('githubSlug and npmPackageName are missing, at least one is required'); | ||
var slug = npmPackageName ? 'npm/' + npmPackageName : 'github/' + githubSlug; | ||
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'); | ||
} | ||
} | ||
// Create | ||
var image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg'; | ||
var url = 'https://givethanks.app/donate/' + slug; | ||
var url = thanksappURL; | ||
var alt = 'Thanks App donate button'; | ||
@@ -694,0 +707,0 @@ var title = 'Donate to this project using Thanks App'; |
@@ -601,14 +601,25 @@ 'use strict'; | ||
* @param {Object} opts | ||
* @param {string} opts.npmPackageName The repository slug (username/reponame) | ||
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges) | ||
* @param {string} opts.npmPackageName The repository slug (username/reponame) | ||
* @param {string} opts.thanksappUsername The username for the Thanks App donate page | ||
* @param {string} opts.thanksappURL The url to the Thanks App donate page | ||
* @return {string} the result badge | ||
*/ | ||
function thanksapp({ githubSlug, npmPackageName }) { | ||
function thanksapp({ npmPackageName, githubSlug, thanksappUsername, thanksappURL }) { | ||
// Check | ||
if (!githubSlug && !npmPackageName) throw new Error('githubSlug and npmPackageName are missing, at least one is required'); | ||
const slug = npmPackageName ? `npm/${npmPackageName}` : `github/${githubSlug}`; | ||
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'); | ||
} | ||
} | ||
// Create | ||
const image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg'; | ||
const url = `https://givethanks.app/donate/${slug}`; | ||
const url = thanksappURL; | ||
const alt = 'Thanks App donate button'; | ||
@@ -615,0 +626,0 @@ const title = 'Donate to this project using Thanks App'; |
# History | ||
## v1.2.8 2018 October 26 | ||
- Added support for `thanksappURL` and `thanksappUsername` for the `thanksapp` badge | ||
## v1.2.7 2018 October 26 | ||
@@ -4,0 +7,0 @@ - Added the crypto badge as a replacement for the bitcoin badge |
{ | ||
"name": "badges", | ||
"version": "1.2.7", | ||
"version": "1.2.8", | ||
"description": "The definitive collection of badges for rendering", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/bevry/badges", |
@@ -48,3 +48,3 @@ <!-- TITLE/ --> | ||
<li>Module: <code>require('badges')</code></li> | ||
<li>CDN URL: <code>//wzrd.in/bundle/badges@1.2.7</code></li></ul> | ||
<li>CDN URL: <code>//wzrd.in/bundle/badges@1.2.8</code></li></ul> | ||
@@ -51,0 +51,0 @@ <a href="http://enderjs.com" title="Ender is a full featured package manager for your browser"><h3>Ender</h3></a><ul> |
@@ -607,14 +607,28 @@ 'use strict' | ||
* @param {Object} opts | ||
* @param {string} opts.npmPackageName The repository slug (username/reponame) | ||
* @param {string} opts.githubSlug The github slug that the project lives at (e.g. bevry/badges) | ||
* @param {string} opts.npmPackageName The repository slug (username/reponame) | ||
* @param {string} opts.thanksappUsername The username for the Thanks App donate page | ||
* @param {string} opts.thanksappURL The url to the Thanks App donate page | ||
* @return {string} the result badge | ||
*/ | ||
function thanksapp ({ githubSlug, npmPackageName }) { | ||
function thanksapp ({ npmPackageName, githubSlug, thanksappUsername, thanksappURL }) { | ||
// Check | ||
if (!githubSlug && !npmPackageName) throw new Error('githubSlug and npmPackageName are missing, at least one is required') | ||
const slug = npmPackageName ? `npm/${npmPackageName}` : `github/${githubSlug}` | ||
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') | ||
} | ||
} | ||
// Create | ||
const image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg' | ||
const url = `https://givethanks.app/donate/${slug}` | ||
const url = thanksappURL | ||
const alt = 'Thanks App donate button' | ||
@@ -621,0 +635,0 @@ const title = 'Donate to this project using Thanks App' |
172627
3898