We use arrow functions in most places; this enforces it. Passing arrow functions to Mocha is discouraged: https://mochajs.org/#arrow-functions This was a mix of autofixes and hand adjustments.
21 lines
515 B
JavaScript
21 lines
515 B
JavaScript
'use strict'
|
|
|
|
const simpleIcons = require('simple-icons')
|
|
const { svg2base64 } = require('./logo-helper')
|
|
|
|
function loadSimpleIcons() {
|
|
Object.keys(simpleIcons).forEach(key => {
|
|
const k = key.toLowerCase().replace(/ /g, '-')
|
|
if (k !== key) {
|
|
simpleIcons[k] = simpleIcons[key]
|
|
delete simpleIcons[key]
|
|
}
|
|
simpleIcons[k].base64 = svg2base64(
|
|
simpleIcons[k].svg.replace('<svg', `<svg fill="#${simpleIcons[k].hex}"`)
|
|
)
|
|
})
|
|
return simpleIcons
|
|
}
|
|
|
|
module.exports = loadSimpleIcons
|