Skip to content

Commit

Permalink
Better ReadMe
Browse files Browse the repository at this point in the history
  • Loading branch information
chilts committed Jul 19, 2018
1 parent 4fef760 commit 740421d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,29 @@ console.log(yid())
// -> 1517049989798-7496988299172
```

A `yid`:
A `yid` is:

* always 27 chars long
* has two parts:
* a timestamp
* a random string
* is of the form `\d{13}-\d{13}`
* starts off with `Date.now()`
* uses `Math.random()` for the second part
* uses a substring of https://www.npmjs.com/package/math-random for the second part

## Why? ##

Why another ID generating library?

I already wrote [zid](https://www.npmjs.com/package/zid) and [flake](https://www.npmjs.com/package/flake) (a long time
ago) and they all have uses. The use for this one is to generate FAST but UNIQUE IDs. A secondary property is that they
are approximately sortable across servers.
ago) and they all have uses. The use for this one is to generate FAST but UNIQUE distributed IDs with no central server
to talk to and no co-ordination required.

A secondary property is that they are approximately sortable across servers.

I got the idea from Google Keep, since the notes have IDs as follows, whereby the first secion is just `Date.now()`:

* '1517050593526.6629835825', e.g. https://keep.google.com/u/1/#NOTE/1517050593526.6629835825

## Author ##

Expand Down

0 comments on commit 740421d

Please sign in to comment.