Compare commits

..

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

3 changed files with 24 additions and 42 deletions

View File

@ -16,40 +16,26 @@ 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 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 without any confusion.
Currently the id space is about 1,000,000 ids (100 * 100 * 100). Currently the id space is about 100,000 ids (100 * 100 * 100).
The goal is to have several billion possible combinations by adding The goal is to have several billion possible combinations by adding
more words as well as expanding the ids to have verbs and adverbs. 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 Usage
======= =======
### npm ### npm
```bash ```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 ```javascript
'use strict'; 'use strict';
var hri = require('human-readable-ids').hri; var hri = require('human-readable-ids').hri
var i; , i
;
// generate 100 random ids // generate 100 random ids
for (i = 0; i < 100; i += 1) { for (i = 0; i < 100; i += 1) {
@ -63,6 +49,15 @@ for (i = 0; i < 100; i += 1) {
bower install --save human-readable-ids 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 ```html
<script src="bower_components/knuth-shuffle/index.js"></script> <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/animals.js"></script>
@ -74,8 +69,9 @@ bower install --save human-readable-ids
;(function (exports) { ;(function (exports) {
'use strict'; 'use strict';
var hri = exports.humanReadableIds || require('human-readable-ids').hri; var hri = exports.humanReadableIds || require('human-readable-ids').hri
var i; , i
;
for (i = 0; i < 100; i += 1) { for (i = 0; i < 100; i += 1) {
console.log(hri.random()); console.log(hri.random());
@ -103,20 +99,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
==== ====

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.1",
"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.1",
"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"
} }