laravel-slug
Advanced tools
Comparing version 2.4.0 to 2.4.1
24
index.js
@@ -149,2 +149,6 @@ /** | ||
// Convert all @ into separator | ||
var ats = RegExp('@', 'ig'); | ||
s = s.replace(ats, opt.delimiter); | ||
// Transliterate characters to ASCII | ||
@@ -158,12 +162,15 @@ if (opt.transliterate) { | ||
// Convert all dashes/underscores into separator | ||
var underscores = RegExp('\_', 'ig'); | ||
s = s.replace(underscores, opt.delimiter); | ||
// Remove all characters that are not the separator, letters, numbers, or whitespace | ||
// Remove all characters that are not the separator, letters or numbers | ||
var saveOldString = s; | ||
var alnum = RegExp('[^' + opt.delimiter + '\\x20-\\x7E]+', 'u'); | ||
var alnum = RegExp('[^' + opt.delimiter + '\\d\\w\\s\\u4e00-\\u9eff]+', 'ig'); | ||
s = s.replace(alnum, ''); | ||
if (!s.length) s = saveOldString; | ||
// to lowercase | ||
s = s.toLowerCase(); | ||
// Convert all dashes/underscores into separator | ||
var underscores = RegExp('\_', 'ig'); | ||
s = s.replace(underscores, opt.delimiter); | ||
// Replace all separator characters and whitespace by a single separator | ||
@@ -179,6 +186,3 @@ var spaces = RegExp('[' + opt.delimiter + '\\s]+', 'ig'); | ||
// Truncate slug to max characters | ||
s = s.substring(0, opt.limit); | ||
return opt.lowercase ? s.toLowerCase() : s; | ||
return s; | ||
} |
{ | ||
"name": "laravel-slug", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "Tries to mimick the slugs produced by Laravel", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
11194
208
0