How to use the badges.renderBadges function in badges

To help you get started, we’ve selected a few badges examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electerm / electerm / bin / badges-output.js View on Github external
// Options for rendering the badges
const options = {
  // Filter Category
  // When set to a string, will only render badges from the list that of the specified category
  // Values can be 'development', 'testing', 'funding', or 'social'
  // E.g. to render only funding badges, set to 'funding'
  filterCategory: false,

  // Filter Scripts
  // When true, do not render any badges from the list that are scripts
  filterScripts: false
}

// Render the badges to a string
const result = require('badges').renderBadges(list, config, options)

// Output the result
console.log(result)
github bevry / projectz / source / lib / badge-util.js View on Github external
function getBadgesSection(data /* :Object */) /* :string */ {
	if (data.badges && data.badges.list) {
		return renderBadges(data.badges.list, data.badges.config, {
			filterScripts: true
		})
	} else {
		return ''
	}
}
github bevry / projectz / source / lib / badge-util.js View on Github external
function getBadgesInCategory(
	category /* :string */,
	data /* :Object */
) /* :string */ {
	if (data.badges && data.badges.list) {
		return renderBadges(data.badges.list, data.badges.config, {
			filterCategory: category,
			filterScripts: true
		})
	} else {
		return ''
	}
}

badges

The definitive collection of badges for rendering

Artistic-2.0
Latest version published 12 months ago

Package Health Score

66 / 100
Full package analysis

Popular badges functions