Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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)
function getBadgesSection(data /* :Object */) /* :string */ {
if (data.badges && data.badges.list) {
return renderBadges(data.badges.list, data.badges.config, {
filterScripts: true
})
} else {
return ''
}
}
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 ''
}
}