Compare commits

..

No commits in common. "master" and "v1.0.0" have entirely different histories.

3 changed files with 14 additions and 83 deletions

View File

@ -11,78 +11,25 @@ Generate ids in the format of `adjective-noun-#` such as
* brave-ladybug-90 * brave-ladybug-90
My problem is that I often want ids that I can type without having to My problem is that I often want ids that I can type without having to
look at twice (nor telling someone else twice). look at it twice (nor telling someone else twice).
I should be able to shout one of these ids across the room to a co-worker 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 without any confusion. or spouse and have them be able to enter it in without any confusion.
Currently the id space is about 1,000,000 ids (100 * 100 * 100). Currently the id space is aboutt 100 * 100 * 100.
The goal is to have several billion possible combinations.
The goal is to have several billion possible combinations by adding Install
more words as well as expanding the ids to have verbs and adverbs.
For a larger address space now, consider:
* Human Readable IDs for Node.js and Browser: <https://github.com/linus/greg/>
* Human Readable IDs for Java: <https://github.com/PerWiklander/IdentifierSentence>
* Human Readable IDs for Python: <https://gist.github.com/4447660>
All of these also have the benefit of bi-directional conversion, but not all of them
have words which are easy to pronounce and spell.
Usage
======= =======
### npm ```
```bash
# from npm
npm install --save human-readable-ids npm install --save human-readable-ids
``` ```
```bash
# directly from git
npm install --save https://git.coolaj86.com/coolaj86/human-readable-ids.js.git
```
```javascript
'use strict';
var hri = require('human-readable-ids').hri;
var i;
// generate 100 random ids
for (i = 0; i < 100; i += 1) {
console.log(hri.random());
}
```
### bower / browser
``` ```
bower install --save human-readable-ids bower install --save human-readable-ids
``` ```
```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;
var i;
for (i = 0; i < 100; i += 1) {
console.log(hri.random());
}
}('undefined' !== typeof exports && exports || new Function('return this')()));
```
Contributing Contributing
============ ============
@ -103,20 +50,6 @@ The pre-publish script outputs the formatted javascript.
* grey, gray, bore, boar (two ways of spelling the same word or sound) * grey, gray, bore, boar (two ways of spelling the same word or sound)
* prawn (not well-known) * prawn (not well-known)
Resources
=========
Add more words and strategies from
* <http://blog.asana.com/2011/09/6-sad-squid-snuggle-softly/>
* The Dolch List <http://www.mrsperkins.com/dolch-words-all.html>
* <http://simple.wikipedia.org/wiki/Wikipedia:Basic_English_alphabetical_wordlist>
* <https://github.com/zacharyvoase/humanhash>
* <https://gist.github.com/ucnv/1121015>
* <https://gist.github.com/vikhyat/105610>
* <http://simple.wikipedia.org/wiki/Wikipedia:List_of_1000_basic_words>
* <http://grammar.yourdictionary.com/parts-of-speech/adverbs/list-of-100-adverbs.html>
TODO TODO
==== ====
@ -124,8 +57,6 @@ Acheive 1 trillion ids with a combination such as
`number adjective noun verb adverb` `number adjective noun verb adverb`
`42-red-foxes-run-quickly`
And allow choosing various formats based on the desired And allow choosing various formats based on the desired
number of ids. number of ids.

View File

@ -1,7 +1,7 @@
{ {
"name": "human-readable-ids", "name": "human-readable-ids",
"main": "index.js", "main": "index.js",
"version": "1.0.3", "version": "1.0.0",
"homepage": "https://github.com/coolaj86/human-readable-ids-js", "homepage": "https://github.com/coolaj86/human-readable-ids-js",
"authors": [ "authors": [
"AJ ONeal <awesome@coolaj86.com>" "AJ ONeal <awesome@coolaj86.com>"

View File

@ -1,6 +1,6 @@
{ {
"name": "human-readable-ids", "name": "human-readable-ids",
"version": "1.0.4", "version": "1.0.0",
"description": "Generate human-readable ids from lists of easy-to-spell nouns and adjectives", "description": "Generate human-readable ids from lists of easy-to-spell nouns and adjectives",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
@ -8,12 +8,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {
"test": "node tests/run-in-node.js", "test": "node tests/run-in-node.js"
"prepublish": "node src/generate-lists" , "prepublish": "node src/generate-lists"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://git.coolaj86.com/coolaj86/human-readable-ids.js.git" "url": "https://github.com/coolaj86/human-readable-ids-js.git"
}, },
"keywords": [ "keywords": [
"hri", "hri",
@ -27,10 +27,10 @@
"nouns", "nouns",
"adjectives" "adjectives"
], ],
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)", "author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.com/)",
"license": "Apache2", "license": "Apache2",
"bugs": { "bugs": {
"url": "https://git.coolaj86.com/coolaj86/human-readable-ids.js/issues" "url": "https://github.com/coolaj86/human-readable-ids-js/issues"
}, },
"homepage": "https://git.coolaj86.com/coolaj86/human-readable-ids.js#readme" "homepage": "https://github.com/coolaj86/human-readable-ids-js"
} }