mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Remove case sensitive
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// https://gist.github.com/marcelo-ribeiro/abd651b889e4a20e0bab558a05d38d77
|
||||
|
||||
const accentsMap = new Map([
|
||||
["A", "Á|À|Ã|Â|Ä"],
|
||||
["a", "á|à|ã|â|ä"],
|
||||
["E", "É|È|Ê|Ë"],
|
||||
["e", "é|è|ê|ë"],
|
||||
["I", "Í|Ì|Î|Ï"],
|
||||
["i", "í|ì|î|ï"],
|
||||
["O", "Ó|Ò|Ô|Õ|Ö"],
|
||||
["o", "ó|ò|ô|õ|ö"],
|
||||
["U", "Ú|Ù|Û|Ü"],
|
||||
["u", "ú|ù|û|ü"],
|
||||
["C", "Ç"],
|
||||
["c", "ç"],
|
||||
["N", "Ñ"],
|
||||
["n", "ñ"]
|
||||
]);
|
||||
|
||||
const reducer = (acc, [key]) => acc.replace(new RegExp(accentsMap.get(key), "gi"), key);
|
||||
export const slugify = (text) => [...accentsMap].reduce(reducer, text.toLowerCase());
|
||||
Reference in New Issue
Block a user