|
|
@ -11,25 +11,74 @@ Generate ids in the format of `adjective-noun-#` such as |
|
|
|
* brave-ladybug-90 |
|
|
|
|
|
|
|
My problem is that I often want ids that I can type without having to |
|
|
|
look at it twice (nor telling someone else twice). |
|
|
|
look at twice (nor telling someone else twice). |
|
|
|
|
|
|
|
I should be able to shout one of these ids across the room to a co-worker |
|
|
|
or spouse and have them be able to enter it in without any confusion. |
|
|
|
or spouse and have them be able to enter it without any confusion. |
|
|
|
|
|
|
|
Currently the id space is aboutt 100 * 100 * 100. |
|
|
|
The goal is to have several billion possible combinations. |
|
|
|
Currently the id space is about 100,000 ids (100 * 100 * 100). |
|
|
|
|
|
|
|
Install |
|
|
|
The goal is to have several billion possible combinations by adding |
|
|
|
more words as well as expanding the ids to have verbs and adverbs. |
|
|
|
|
|
|
|
Usage |
|
|
|
======= |
|
|
|
|
|
|
|
``` |
|
|
|
### npm |
|
|
|
|
|
|
|
```bash |
|
|
|
npm install --save human-readable-ids |
|
|
|
``` |
|
|
|
|
|
|
|
```javascript |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
var hri = require('human-readable-ids').hri |
|
|
|
, i |
|
|
|
; |
|
|
|
|
|
|
|
// generate 100 random ids |
|
|
|
for (i = 0; i < 100; i += 1) { |
|
|
|
console.log(hri.random()); |
|
|
|
} |
|
|
|
``` |
|
|
|
|
|
|
|
### bower / browser |
|
|
|
|
|
|
|
``` |
|
|
|
bower install --save human-readable-ids |
|
|
|
``` |
|
|
|
|
|
|
|
```jade |
|
|
|
html |
|
|
|
head |
|
|
|
script(src="bower_components/knuth-shuffle/index.js") |
|
|
|
script(src="bower_components/human-readable-ids/assets/animals.js") |
|
|
|
script(src="bower_components/human-readable-ids/assets/adjectives.js") |
|
|
|
script(src="bower_components/human-readable-ids/index.js") |
|
|
|
``` |
|
|
|
|
|
|
|
```html |
|
|
|
<script src="bower_components/knuth-shuffle/index.js"></script> |
|
|
|
<script src="bower_components/human-readable-ids/assets/animals.js"></script> |
|
|
|
<script src="bower_components/human-readable-ids/assets/adjectives.js"></script> |
|
|
|
<script src="bower_components/human-readable-ids/index.js"></script> |
|
|
|
``` |
|
|
|
|
|
|
|
```javascript |
|
|
|
;(function (exports) { |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
var hri = exports.humanReadableIds || require('human-readable-ids').hri |
|
|
|
, i |
|
|
|
; |
|
|
|
|
|
|
|
for (i = 0; i < 100; i += 1) { |
|
|
|
console.log(hri.random()); |
|
|
|
} |
|
|
|
}('undefined' !== typeof exports && exports || new Function('return this')())); |
|
|
|
``` |
|
|
|
|
|
|
|
Contributing |
|
|
|
============ |
|
|
|
|
|
|
@ -57,6 +106,8 @@ Acheive 1 trillion ids with a combination such as |
|
|
|
|
|
|
|
`number adjective noun verb adverb` |
|
|
|
|
|
|
|
`42-red-foxes-run-quickly` |
|
|
|
|
|
|
|
And allow choosing various formats based on the desired |
|
|
|
number of ids. |
|
|
|
|
|
|
|