Ulifyi Leaves is a JavaScript library for generating unique Snowflake IDs similar to Twitter's Snowflake IDs. It allows you to easily integrate globally unique identifier generation into your applications.
- Generate unique Leave IDs.
- Customizable machine ID.
- Thread-safe ID generation.
npm install ulifyi-leaves
const Leaves = require('ulifyi-leaves');
const machineId = 1; // Your unique machine ID
const leaves = new Leaves(machineId);
const Leaves = require('./leaves');
const machineId = 1;
const leaves = new Leaves(machineId);
for (let i = 0; i < 10; i++) {
console.log(leaves.generateId());
}
constructor(machineId: number)
: Initializes the Leaves instance with the provided machine ID.generateId()
: string: Generates a unique Leave ID.
Contributions are welcome! Please feel free to submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details. node index.js