Skip to content

Commit

Permalink
Merge pull request #3 from tadatuta/master
Browse files Browse the repository at this point in the history
Support for non-latin chars
  • Loading branch information
Flet committed Apr 22, 2016
2 parents 807776f + b9f473b commit 35f165f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ BananaSlug.prototype.reset = function () {
var whitespace = /\s/g

function slugger (string) {
var allowedCharacters = 'A-Za-z0-9_ -'
var re = new RegExp('[^' + allowedCharacters + ']', 'g')
var re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g
var maintainCase = false
var replacement = '-'
var result
Expand Down
5 changes: 5 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,10 @@ var testCases = [
mesg: 'deals with duplicates correctly-2',
text: 'duplicate',
slug: 'duplicate-2'
},
{
mesg: 'deals with non-latin chars',
text: 'Привет',
slug: 'привет'
}
]

0 comments on commit 35f165f

Please sign in to comment.