Fixed number at the beginning of the slug, fixed #51

This commit is contained in:
qingwei.li 2017-01-10 14:39:40 +08:00
commit b8b9dbc872
2 changed files with 6 additions and 0 deletions

View file

@ -1,3 +1,7 @@
## 1.5.2
### Bug fixes
- Fixed number at the beginning of the slug
## 1.5.1
### Bug fixes
- Remove HTML tag when handling slug

View file

@ -120,6 +120,8 @@ export function slugify (string) {
.replace(/<[^>\d]+>/g, '')
.replace(re, '')
.replace(/\s/g, replacement)
.replace(/-+/g, replacement)
.replace(/^(\d)/, '_$1')
let occurrences = slugify.occurrences[slug]
if (slugify.occurrences.hasOwnProperty(slug)) {