make uid function reusable

This commit is contained in:
ansuz
2017-08-24 11:31:20 +02:00
parent 443d8a8941
commit b71f1860db
3 changed files with 9 additions and 6 deletions

View File

@@ -7,6 +7,11 @@ define([], function () {
}, map));
};
Util.uid = function () {
return Number(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER))
.toString(32).replace(/\./g, '');
};
Util.fixHTML = function (str) {
if (!str) { return ''; }
return str.replace(/[<>&"']/g, function (x) {