1.1.0 • Published 11 years ago
firebase-auto-ids v1.1.0
firebase-auto-ids 
Generate random time-based, collision-proof IDs a la Firebase.push. Designed for testing and education (readability), not performance.
Installing
$ npm install firebase-auto-idsAPI
generate(now) -> String
firebase-auto-ids exports a function. Pass in now, the current timestamp (e.g. Date.now()). generate returns an ID string. Like Firebase.push, IDs hold the following properties:
id1<id2whereid1was created at an earlier time (now) thanid2id1<id2whereid1andid2were created at the samenowbutgenerateAutoIdwas executed forid1beforeid2id1!==id2whereid1andid2were created at the samenowin different clients
new generate.Generator() -> generator
Creates a new generator instance. Individual instances do not share state. This means that IDs created at the same time in a given runtime will no longer be determined by call order.
generator.generate(now) -> String
Same as generate(now)