Browse files

update package, readme, added example and makefile

  • Loading branch information...
1 parent 79dea61 commit ed1b1257a7a01d44ff07db7e2354da2d55b50397 @dylang committed Dec 19, 2011
Showing with 47 additions and 8 deletions.
  1. +8 −0 examples/examples.js
  2. +5 −0 makefile
  3. +2 −3 package.json
  4. +32 −5 readme.md
View
8 examples/examples.js
@@ -0,0 +1,8 @@
+var ShortId = require('../index');
+
+//Generate 10 ids
+
+var i = 10;
+while (i--) {
+ console.log(ShortId.generate());
+}
View
5 makefile
@@ -0,0 +1,5 @@
+
+test:
+ ./node_modules/.bin/mocha --reporter spec
+
+.PHONY: test
View
5 package.json
@@ -1,6 +1,6 @@
{
"name":"shortid",
- "version":"1.0.1",
+ "version":"1.0.2",
"description":"Short unique id generator. Url-friendly. Non-predictable. Cluster-compatible.",
"keywords": ["short", "tiny", "id", "uuid", "bitly", "shorten", "mongoid", "shortid", "tinyid", "id"],
"homepage":"http://doodleordie.com",
@@ -26,8 +26,7 @@
"node":">=0.6"
},
"scripts":{
- "start":"node cluster",
- "test": "nodeunit test"
+ "test": "make test"
},
"licenses" :
[
View
37 readme.md
@@ -9,11 +9,38 @@ ShortId is a tiny id generator good for creating guarenteed unique ids that are
* Includes cluster worker id so you can use this on multi-processor server instances.
* Includes tests that run on Mocha.
-## ShortId.generate() returns id
+```javascript
+ var ShortId = require('../index');
+ var i = 10;
+ while (i--) {
+ console.log(ShortId.generate());
+ }
+
+ // Resulting ids:
+ PPBqWA9
+ PefBO4A
+ eV9B94A
+ eemGO4d
+ PPGBqhd
+ VPyX9hw
+ eeDX94w
+ PT7GOWA
+ PP4XqWA
+ PTxG9hD
+```
-Other functions (docs coming soon)
+## ShortId.generate()
-* ShortId.version(int) sets version, returns ShortId
-* ShortId.worker(int) sets cluster worker, returns ShortId
+Returns an id.
-See the tests for more examples.
+
+## Other functions
+
+(Full docs coming soon.)
+
+* ShortId.version(int) sets version, returns ShortId module.
+* ShortId.worker(int) sets cluster worker, returns ShortId module.
+
+See the tests for more examples.
+
+Created for Node Knockout 2011 winner [Doodle Or Die](http://doodleordie.com).

0 comments on commit ed1b125

Please sign in to comment.