blob: ce038fd1692da6c3d684fe1735321335b760713f (
plain) (
tree)
|
|
---
title: JavaScript naive slugify
date: 2021-04-03
layout: post
lang: en
ref: javascript-naive-slugify
---
```javascript
const s = "Pézão: açaí, saci-pererê.";
function slugify(s) {
return s
.toLowerCase()
.replaceAll(":", "")
.replaceAll(".", "")
.replaceAll(",", "")
.replaceAll("-", "")
.replaceAll("á", "a")
.replaceAll("ã", "a")
.replaceAll("à", "a")
.replaceAll("é", "e")
.replaceAll("ê", "e")
.replaceAll("í", "i")
.replaceAll("ó", "o")
.replaceAll("ô", "o")
.replaceAll("ú", "u")
.replaceAll("ü", "u")
.replaceAll("ç", "c");
}
console.log(slugify(s));
```
|