sfcode
An Online Competing and Development Environment
|
Yeast is a unique id generator. It has been primarily designed to generate a unique id which can be used for cache busting. A common practice for this is to use a timestamp, but there are couple of downsides when using timestamps.
Yeast solves both of these issues by:
encode()
function that returns a string representation of the number.To keep the strings unique it will use the .
char to separate the generated stamp from the seed.
The module is intended to be used in browsers as well as in Node.js and is therefore released in the npm registry and can be installed using:
All the examples assume that this library is initialized as follow:
To generate an id just call the yeast
function.
An helper function that returns a string representing the specified number. The returned string contains only URL safe characters.
An helper function that returns the integer value specified by the given string. This function can be used to retrieve the timestamp from a yeast
id.
That's all folks. If you have ideas on how we can further compress the ids please open an issue!
[MIT](LICENSE)