breaking: #8808, remove utils.slugify

This commit is contained in:
Barış Soner Uşaklı
2020-12-06 13:18:09 -05:00
parent 1c45fa1ba5
commit 4a0d883359
8 changed files with 0 additions and 1945 deletions

View File

@@ -328,43 +328,6 @@
return String(str).replace(new RegExp('<(\\/)?(' + (pattern || '[^\\s>]+') + ')(\\s+[^<>]*?)?\\s*(\\/)?>', 'gi'), '');
},
// TODO: remove XRegExp & all these in 1.16.0, they are moved to slugify module
invalidUnicodeChars: XRegExp('[^\\p{L}\\s\\d\\-_]', 'g'),
invalidLatinChars: /[^\w\s\d\-_]/g,
trimRegex: /^\s+|\s+$/g,
collapseWhitespace: /\s+/g,
collapseDash: /-+/g,
trimTrailingDash: /-$/g,
trimLeadingDash: /^-/g,
isLatin: /^[\w\d\s.,\-@]+$/,
// http://dense13.com/blog/2009/05/03/converting-string-to-slug-javascript/
slugify: function (str, preserveCase) {
var stack = new Error('utils.slugify').stack.split('\n').slice(0, 4).join('\n');
if (typeof module === 'object' && module.exports) {
console.warn('[deprecated] utils.slugify deprecated. Use `require("slugify")` instead.\n' + stack);
} else {
console.warn('[deprecated] utils.slugify deprecated. Use `require(["slugify"], function (slugify) { ... })` instead.\n' + stack);
}
if (!str) {
return '';
}
str = String(str).replace(utils.trimRegex, '');
if (utils.isLatin.test(str)) {
str = str.replace(utils.invalidLatinChars, '-');
} else {
str = XRegExp.replace(str, utils.invalidUnicodeChars, '-');
}
str = !preserveCase ? str.toLocaleLowerCase() : str;
str = str.replace(utils.collapseWhitespace, '-');
str = str.replace(utils.collapseDash, '-');
str = str.replace(utils.trimTrailingDash, '');
str = str.replace(utils.trimLeadingDash, '');
return str;
},
cleanUpTag: function (tag, maxLength) {
if (typeof tag !== 'string' || !tag.length) {
return '';