(string)
| 1 | function slugify(string) { |
| 2 | const a = 'àáäâãåăæąçćčđďèéěėëêęğǵḧìíïîįłḿǹńňñòóöôœøṕŕřßşśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;' |
| 3 | const b = 'aaaaaaaaacccddeeeeeeegghiiiiilmnnnnooooooprrsssssttuuuuuuuuuwxyyzzz------' |
| 4 | const p = new RegExp(a.split('').join('|'), 'g') |
| 5 | |
| 6 | return string.toString().toLowerCase() |
| 7 | .replace(/\s+/g, '-') // Replace spaces with - |
| 8 | .replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters |
| 9 | .replace(/&/g, '-and-') // Replace & with 'and' |
| 10 | .replace(/[^\w-]+/g, '') // Remove all non-word characters |
| 11 | .replace(/--+/g, '-') // Replace multiple - with single - |
| 12 | .replace(/^-+/, '') // Trim - from start of text |
| 13 | .replace(/-+$/, '') // Trim - from end of text |
| 14 | } |
| 15 | |
| 16 | function titleIfy(slug) { |
| 17 | var words = slug.split('-') |
no outgoing calls
no test coverage detected