Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
The yeast npm package is a simple utility for generating unique IDs based on the current time. It is lightweight and designed to be used in environments where unique identifiers are needed, such as in distributed systems or for generating unique keys in databases.
Generate Unique IDs
This feature allows you to generate a unique ID based on the current time. The generated ID is a string that can be used as a unique identifier in various applications.
const yeast = require('yeast');
const uniqueID = yeast();
console.log(uniqueID);
The uuid package is a popular library for generating universally unique identifiers (UUIDs). Unlike yeast, which generates IDs based on the current time, uuid generates IDs that are globally unique and can be used in a wide range of applications. It supports multiple versions of UUIDs, including time-based, random, and namespace-based UUIDs.
The shortid package is another library for generating short, unique, non-sequential IDs. It is similar to yeast in that it generates short IDs, but it uses a different algorithm that ensures the IDs are unique even across distributed systems. shortid is useful for cases where you need a human-readable ID that is still unique.
The nanoid package is a modern library for generating unique IDs with a focus on performance and security. It generates shorter IDs than uuid and is more secure than shortid. nanoid is suitable for use in both client-side and server-side applications and provides a good balance between ID length and uniqueness.
Yeast is a unique id generator. It was primary designed to generate a unique id which can be used for cache busting in requests. A common practise for this is to use a time stamp. But there are couple of down sides when using timestamps.
Yeast solves both of these issues by:
toSting(36)
.To keep the strings unique it will use the :
char to separate the generated
stamp from the seed. As we're using toString(36)
to encode the time stamp you
can still retrieve the actual time stamp by parsing it again using
parseInt(yeastID, 36)
.
The module is intended to be used in browsers as well as in Node.js and is therefor released in the npm registry and can be installed using:
npm install --save yeast
This module only exposes one single interface, so when you require yeast it will return a function that generates the unique ids:
'use strict';
var yeast = require('yeast');
console.log(yeast(), yeast(), yeast()); // outputs: i24hcpc4 i24hcpc4:0 i24hcpc4:1
setTimeout(function () {
console.log(yeast()); // outputs: i24hd9hw
});
That's all folks. If you have ideas on how we can further compress the ids please open an issue!
MIT
FAQs
Tiny but linear growing unique id generator
The npm package yeast receives a total of 1,523,962 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.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.