mirror of
https://github.com/simple-icons/simple-icons.git
synced 2025-03-03 14:32:16 +02:00
* Replace ampersand to avoid problems with filenames Together with some examples as test * Revert filename changes for testing purposes
18 lines
505 B
JavaScript
18 lines
505 B
JavaScript
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, "")
|
|
)
|
|
}
|