Permalink
Browse files

make shortid compatible with older versions of node

  • Loading branch information...
1 parent f2bf4a2 commit 3ab1a575ef71706e02a43ca855ca0d89c0de3126 @dylang committed Jan 3, 2012
Showing with 8 additions and 2 deletions.
  1. +6 −0 lib/shortid.js
  2. +2 −2 package.json
View
@@ -5,6 +5,12 @@
*/
var randomBytes = require('crypto').randomBytes
+// Older (pre 0.6) versions of Node don't have a randomBytes function
+if (!randomBytes) {
+ randomBytes = function(){
+ return [Math.random()*256];
+ }
+}
// remove from Date.now all the milliseconds before this thing was created
var LESS_TIME = 1324151035201;
View
@@ -1,6 +1,6 @@
{
"name":"shortid",
- "version":"1.0.3",
+ "version":"1.0.5",
"description":"Amazingly short non-sequential url-friendly unique id generator.",
"keywords": ["short", "tiny", "id", "uuid", "bitly", "shorten", "mongoid", "shortid", "tinyid", "id"],
"homepage":"http://github.com/dylang/shortid",
@@ -23,7 +23,7 @@
},
"main":"index",
"engines":{
- "node":">=0.6"
+ "node":">=0.4.x"
},
"scripts":{
"test": "make test"

0 comments on commit 3ab1a57

Please sign in to comment.