blob: f765495c44c5f689bfca891a804695e124cf29df (
plain) (
tree)
|
|
---
title: JavaScript naive slugify
date: 2021-04-03
updated_at: 2021-08-15
layout: post
lang: en
ref: javascript-naive-slugify
---
```javascript
const s = "Pézão: açaí, saci-pererê.";
const slugify = s =>
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));
```
|