Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Readme
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:
npm install --save yeast
All the examples assume that this library is initialized as follow:
'use strict';
var yeast = require('yeast');
To generate an id just call the yeast
function.
console.log(yeast(), yeast(), yeast()); // outputs: KyxidwN KyxidwN.0 KyxidwN.1
setTimeout(function () {
console.log(yeast()); // outputs: KyxidwO
});
An helper function that returns a string representing the specified number. The returned string contains only URL safe characters.
yeast.encode(+new Date()); // outputs: Kyxjuo1
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.
var id = yeast(); // holds the value: Kyxl1OU
yeast.decode(id); // outputs: 1439816226334
That's all folks. If you have ideas on how we can further compress the ids please open an issue!
FAQs
Tiny but linear growing unique id generator
The npm package yeast receives a total of 1,275,751 weekly downloads. As such, yeast popularity was classified as popular.
We found that yeast demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.