diff --git a/lib/utils.js b/lib/utils.js index b615412..ddeb010 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -58,6 +58,18 @@ var utils = { // remove all special characters & spaces safeString: function( string ){ return string.replace(/[^a-zA-Z0-9]/g,''); + }, + + // - Creates a unique id for identification purposes + uniqueID : function (separator) { + + var delim = separator || "-"; + + function S4() { + return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); + } + + return (S4() + S4() + delim + S4() + delim + S4() + delim + S4() + delim + S4() + S4() + S4()); } };