Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change default id generator to be RFC4122 compliant

  • Loading branch information...
commit b36895e7f3afe05e0c3fe6398b81c3909a89bff3 1 parent 83be9de
@tedeh authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/utils.js
View
5 lib/utils.js
@@ -79,7 +79,10 @@ Utils.response = function(error, result, id, version) {
* @api public
*/
Utils.generateId = function() {
- return Math.round(Math.random() * Math.pow(2, 24));
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
+ var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
+ return v.toString(16);
+ });
};
/**
Please sign in to comment.
Something went wrong with that request. Please try again.