function slugify(value) { if (typeof value !== 'string') { throw new TypeError('Input must be a string'); } value = value.trim().toLowerCase(); value = require('unicode-normalization').normalize(value, 'NFKD'); value = value.replace(/[\u0300-\u036f]/g, ''); value = value.replace(/[^a-z0-9]+/g, '-').trim('-'); return value || ''; }