(str)
| 8 | } |
| 9 | |
| 10 | export function slugify(str) { |
| 11 | if (typeof str !== 'string') { |
| 12 | return ''; |
| 13 | } |
| 14 | |
| 15 | let slug = str |
| 16 | .trim() |
| 17 | .replace(/[A-Z]+/g, lower) |
| 18 | .replace(/<[^>]+>/g, '') |
| 19 | .replace(re, '') |
| 20 | .replace(/\s/g, '-') |
| 21 | .replace(/-+/g, '-') |
| 22 | .replace(/^(\d)/, '_$1'); |
| 23 | let count = cache[slug]; |
| 24 | |
| 25 | count = hasOwn.call(cache, slug) ? count + 1 : 0; |
| 26 | cache[slug] = count; |
| 27 | |
| 28 | if (count) { |
| 29 | slug = slug + '-' + count; |
| 30 | } |
| 31 | |
| 32 | return slug; |
| 33 | } |
| 34 | |
| 35 | slugify.clear = function () { |
| 36 | cache = {}; |
no outgoing calls
no test coverage detected
searching dependent graphs…