الأربعاء، 15 يوليو 2015

Javascript Unique UUID like JAVA UUID Pattern. with Time stamp -GUID

Here is the JavaScript version of the UUID Generator.
it will give the Unique UUIDs

same like the java pattern.



function nextUUID() {
function _pattern(t, s) {
var p = ((t ? (Date.now()) : (Math.random())).toString(16) + "0000000").substr(2, 8);
return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p;
}
return _pattern(true) + _pattern(false, true) + _pattern(false, true) + _pattern();
}

Please Comment below if you need any further clarifications.

ليست هناك تعليقات:

إرسال تعليق