Comparing version 1.0.1 to 1.0.2
@@ -27,9 +27,13 @@ (function() { | ||
// See: http://www.unicode.org/versions/Unicode6.0.0/ch12.pdf - Table 12-2 | ||
if (0x4E00 <= code && code <= 0x9FFF) rv.push(c); | ||
if (allowedChars.indexOf(c) != -1) rv.push(c); | ||
if (0x4E00 <= code && code <= 0x9FFF) { | ||
rv.push(c); | ||
continue; | ||
} | ||
if (allowedChars.indexOf(c) != -1) { | ||
rv.push(c); | ||
continue; | ||
} | ||
var val = _unicodeCategory(code); | ||
if (val) { | ||
if (~'LN'.indexOf(val)) rv.push(c); | ||
if (~'Z'.indexOf(val)) rv.push(' '); | ||
} | ||
if (val && ~'LN'.indexOf(val)) rv.push(c); | ||
if (val && ~'Z'.indexOf(val)) rv.push(' '); | ||
} | ||
@@ -36,0 +40,0 @@ slug = rv.join('').replace(/^\s+|\s+$/g, '').replace(/\s+/g,' '); |
{ | ||
"name" : "uslug", | ||
"version" : "1.0.1", | ||
"version" : "1.0.2", | ||
"description" : "A permissive slug generator that works with unicode.", | ||
@@ -5,0 +5,0 @@ "author": "Jeremy Selier <jerem.selier@gmail.com>", |
@@ -27,3 +27,4 @@ var should = require('should'), | ||
['เแโ|ใไ', 'เแโใไ'], | ||
['日本語ドキュメンテ(ーション)', '日本語ドキュメンテーション'] | ||
['日本語ドキュメンテ(ーション)', '日本語ドキュメンテーション'], | ||
['一二三四五六七八九十!。。。', '一二三四五六七八九十'] | ||
]; | ||
@@ -34,2 +35,4 @@ | ||
uslug(test[0]).should.equal(test[1]); | ||
} | ||
} | ||
uslug('qbc,fe', { allowedChars: 'q' }).should.equal('qbcfe'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113014
106