Skip to content

Instantly share code, notes, and snippets.

@N0NameF0und
N0NameF0und / javascript-remove-accents.js
Created May 13, 2021 21:36 — forked from marcelo-ribeiro/javascript-remove-accents.js
An Javascript function to remove accents, spaces and set lower case from an input string.
const slugify = str => {
const map = {
'-' : ' ',
'-' : '_',
'a' : 'á|à|ã|â|ä|À|Á|Ã|Â|Ä',
'e' : 'é|è|ê|ë|É|È|Ê|Ë',
'i' : 'í|ì|î|ï|Í|Ì|Î|Ï',
'o' : 'ó|ò|ô|õ|ö|Ó|Ò|Ô|Õ|Ö',
'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü',
'c' : 'ç|Ç',