Skip to content

Instantly share code, notes, and snippets.

View matheusgnreis's full-sized avatar

Matheus Reis matheusgnreis

View GitHub Profile
@matheusgnreis
matheusgnreis / README.md
Created October 26, 2021 19:05 — forked from greyscaled/README.md
Sequelize + Express + Migrations + Seed Starter
@matheusgnreis
matheusgnreis / slugify.js
Created June 16, 2022 15:53 — forked from codeguy/slugify.js
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}