Forked from marcelo-ribeiro/javascript-remove-accents.js
Created
May 13, 2021 21:36
-
-
Save N0NameF0und/703a3a6d6e2ca921924fb7316a8f772d to your computer and use it in GitHub Desktop.
Revisions
-
marcelo-ribeiro revised this gist
Apr 9, 2021 . 1 changed file with 10 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,18 @@ const slugify = str => { const map = { '-' : ' ', '-' : '_', 'a' : 'á|à|ã|â|ä|À|Á|Ã|Â|Ä', 'e' : 'é|è|ê|ë|É|È|Ê|Ë', 'i' : 'í|ì|î|ï|Í|Ì|Î|Ï', 'o' : 'ó|ò|ô|õ|ö|Ó|Ò|Ô|Õ|Ö', 'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü', 'c' : 'ç|Ç', 'n' : 'ñ|Ñ' }; for (var pattern in map) { str = str.replace(new RegExp(map[pattern], 'g'), pattern); } return str; -
marcelo-ribeiro revised this gist
Apr 9, 2021 . 1 changed file with 16 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,19 @@ const slugify = str => { const map = { '-' : ' ', '-' : '_', 'a' : 'á|à|ã|â|ä|À|Á|Ã|Â|Ä', 'e' : 'é|è|ê|ë|É|È|Ê|Ë', 'i' : 'í|ì|î|ï|Í|Ì|Î|Ï', 'o' : 'ó|ò|ô|õ|ö|Ó|Ò|Ô|Õ|Ö', 'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü', 'c' : 'ç|Ç', 'n' : 'ñ|Ñ' }; for (var pattern in map) { str = str.replace(new RegExp(map[pattern], 'g'), pattern); } return str; } -
marcelo-ribeiro revised this gist
Apr 9, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ const slugify = str => { const map = { '-' : ' ', '-' : '_', 'a' : 'á|à|ã|â|ä|À|Á|Ã|Â|Ä', -
marcelo-ribeiro revised this gist
Apr 9, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ function slugify (str) { for (var pattern in map) { str = str.replace(new RegExp(map[pattern], 'g'), pattern); } return str; } -
marcelo-ribeiro revised this gist
Mar 11, 2021 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,10 +2,10 @@ function slugify (str) { var map = { '-' : ' ', '-' : '_', 'a' : 'á|à|ã|â|ä|À|Á|Ã|Â|Ä', 'e' : 'é|è|ê|ë|É|È|Ê|Ë', 'i' : 'í|ì|î|ï|Í|Ì|Î|Ï', 'o' : 'ó|ò|ô|õ|ö|Ó|Ò|Ô|Õ|Ö', 'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü', 'c' : 'ç|Ç', 'n' : 'ñ|Ñ' -
marcelo-ribeiro revised this gist
Jul 28, 2020 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,8 +11,6 @@ function slugify (str) { 'n' : 'ñ|Ñ' }; for (var pattern in map) { str = str.replace(new RegExp(map[pattern], 'g'), pattern); }; -
marcelo-ribeiro revised this gist
Feb 10, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ function slugify (str) { '-' : '_', 'a' : 'á|à|ã|â|À|Á|Ã|Â', 'e' : 'é|è|ê|É|È|Ê', 'i' : 'í|ì|î|Í|Ì|Î', 'o' : 'ó|ò|ô|õ|Ó|Ò|Ô|Õ', 'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü', 'c' : 'ç|Ç', -
marcelo-ribeiro revised this gist
Feb 10, 2017 . No changes.There are no files selected for viewing
-
marcelo-ribeiro revised this gist
Feb 10, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ function slugify (str) { var map = { '-' : ' ', '-' : '_', 'a' : 'á|à|ã|â|À|Á|Ã|Â', 'e' : 'é|è|ê|É|È|Ê', 'i' : 'í|ì|î', -
marcelo-ribeiro renamed this gist
Feb 10, 2017 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ function slugify (str) { var map = { 'a' : 'á|à|ã|â|À|Á|Ã|Â', 'e' : 'é|è|ê|É|È|Ê', 'i' : 'í|ì|î', @@ -9,9 +9,11 @@ function removeAccents (str) { 'n' : 'ñ|Ñ' }; str = str.toLowerCase(); for (var pattern in map) { str = str.replace(new RegExp(map[pattern], 'g'), pattern); }; return str; }; -
Fábio Santos revised this gist
Dec 10, 2015 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,9 @@ function removeAccents (str) { 'e' : 'é|è|ê|É|È|Ê', 'i' : 'í|ì|î', 'o' : 'ó|ò|ô|õ|Ó|Ò|Ô|Õ', 'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü', 'c' : 'ç|Ç', 'n' : 'ñ|Ñ' }; angular.forEach(map, function (pattern, newValue) { -
Fábio Santos created this gist
Dec 10, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ function removeAccents (str) { map = { 'a' : 'á|à|ã|â|À|Á|Ã|Â', 'e' : 'é|è|ê|É|È|Ê', 'i' : 'í|ì|î', 'o' : 'ó|ò|ô|õ|Ó|Ò|Ô|Õ', 'u' : 'ú|ù|û|Ú|Ù|Û', 'c' : 'ç|Ç' }; angular.forEach(map, function (pattern, newValue) { str = str.replace(new RegExp(pattern, 'g'), newValue); }); return str; };