1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-12-26 01:13:41 +02:00
simple-icons/scripts/utils.js

17 lines
504 B
JavaScript
Raw Normal View History

module.exports = {
/**
* Converts a brand title into a filename (not a full path)
* @param {String} title The title to convert
*/
titleToFilename: title => (
title.toLowerCase()
.replace(/\+/g, "plus")
.replace(/^\./, "dot-")
.replace(/\.$/, "-dot")
.replace(/\./g, "-dot-")
.replace(/^&/, "and-")
.replace(/&$/, "-and")
.replace(/&/g, "-and-")
.replace(/[ !’]/g, "")
)
}