diff --git a/index.js b/index.js index ff04c26..414cfc6 100644 --- a/index.js +++ b/index.js @@ -46,16 +46,12 @@ BananaSlug.prototype.reset = function () { var whitespace = /\s/g -function lower (string) { - return string.toLowerCase() -} - function slugger (string, maintainCase) { var re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g var replacement = '-' if (typeof string !== 'string') return '' - if (!maintainCase) string = string.replace(/[A-Z]+/g, lower) + if (!maintainCase) string = string.toLowerCase() return string.trim() .replace(re, '') .replace(emoji(), '') diff --git a/russian.md b/russian.md new file mode 100644 index 0000000..14ee8ef --- /dev/null +++ b/russian.md @@ -0,0 +1,5 @@ +# Профили пользователей + +# Привет + +# Привет-non-latin-你好 \ No newline at end of file diff --git a/test/index.js b/test/index.js index 801b27e..2c0f9b6 100644 --- a/test/index.js +++ b/test/index.js @@ -89,7 +89,7 @@ var testCases = [ { mesg: 'deals with non-latin chars', text: 'Привет', - slug: 'Привет' + slug: 'привет' }, // https://github.com/wooorm/gh-and-npm-slug-generation { @@ -160,7 +160,7 @@ var testCases = [ { mesg: 'gh-and-npm-slug-generation-14', text: 'Привет non-latin 你好', - slug: 'Привет-non-latin-你好' + slug: 'привет-non-latin-你好' }, // https://github.com/chrisdickinson/emoji-slug-example { @@ -182,5 +182,10 @@ var testCases = [ mesg: 'emoji-slug-example-4', text: ':ok_hand: :hatched_chick: Two in a row', slug: 'ok_hand-hatched_chick-two-in-a-row' + }, + { + mesg: 'Cyrillic', + text: 'Профили пользователей', + slug: 'профили-пользователей' } ]