-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.js
27 lines (26 loc) · 847 Bytes
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// https://github.com/simple-icons/simple-icons/blob/master/scripts/utils.js
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, "")
.replace(/à|á|â|ã|ä/, "a")
.replace(/ç/, "c")
.replace(/è|é|ê|ë/, "e")
.replace(/ì|í|î|ï/, "i")
.replace(/ñ/, "n")
.replace(/ò|ó|ô|õ|ö/, "o")
.replace(/ù|ú|û|ü/, "u")
.replace(/ý|ÿ/, "y")
)
}