2018-08-27 00:23:57 +03:00
|
|
|
|
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-")
|
2018-09-10 18:53:59 +03:00
|
|
|
|
.replace(/^&/, "and-")
|
|
|
|
|
.replace(/&$/, "-and")
|
|
|
|
|
.replace(/&/g, "-and-")
|
2018-08-27 00:23:57 +03:00
|
|
|
|
.replace(/[ !’]/g, "")
|
2019-05-29 00:56:20 +03:00
|
|
|
|
.replace(/à|á|â|ã|ä/, "a")
|
|
|
|
|
.replace(/ç/, "c")
|
|
|
|
|
.replace(/è|é|ê|ë/, "e")
|
|
|
|
|
.replace(/ì|í|î|ï/, "i")
|
|
|
|
|
.replace(/ñ/, "n")
|
|
|
|
|
.replace(/ò|ó|ô|õ|ö/, "o")
|
|
|
|
|
.replace(/ù|ú|û|ü/, "u")
|
|
|
|
|
.replace(/ý|ÿ/, "y")
|
2019-07-04 00:33:03 +03:00
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts a brand title in HTML friendly format into a brand title (as it
|
|
|
|
|
* is seen in simple-icons.json)
|
|
|
|
|
* @param {String} htmlFriendlyTitle The title to convert
|
|
|
|
|
*/
|
|
|
|
|
htmlFriendlyToTitle: htmlFriendlyTitle => (
|
|
|
|
|
htmlFriendlyTitle
|
|
|
|
|
.replace(/&/g, "&")
|
|
|
|
|
.replace(/'/g, "’")
|
2018-08-27 00:23:57 +03:00
|
|
|
|
)
|
2019-04-17 12:59:44 +03:00
|
|
|
|
}
|