This commit is contained in:
2019-06-19 21:55:19 +00:00
parent c25df1264b
commit ae0999647c
2 changed files with 44 additions and 23 deletions

View File

@@ -1,5 +1,7 @@
/* Xeslint-disable */
import _ from "../libs/lodash.min.js";
/////////////////////////////////
// General utility library
//
@@ -69,6 +71,31 @@ export default {
}
}
return true;
},
///////////////////////////////
// CLEAN TAG NAME
// Clean up a tag with same rules as server
//
normalizeTag: function(tagName) {
//kebab case takes care of all the things we need for tags in one go
tagName = _.kebabCase(tagName);
//No longer than 255 characters
tagName = tagName.length > 255 ? tagName.substr(0, 255 - 1) : tagName;
return tagName;
//
// //This may be naive when we get international customers but for now supporting utf-8 and it appears it's safe to do this with unicode
// inObj = inObj.ToLowerInvariant();
// //No spaces in tags, replace with dashes
// inObj = inObj.Replace(" ", "-");
// //Remove multiple dash sequences
// inObj = System.Text.RegularExpressions.Regex.Replace(inObj, "-+", "-");
// //Ensure doesn't start or end with a dash
// inObj = inObj.Trim('-');
// //No longer than 255 characters
// inObj = StringUtil.MaxLength(inObj, 255);
// return inObj;
}
//new functions above here