Skip to content

N6KV/ulifyi-leaves

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Ulifyi Leaves

npm version npm downloads GitHub license

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.

Features

  • Generate unique Leave IDs.
  • Customizable machine ID.
  • Thread-safe ID generation.

Installation

npm install ulifyi-leaves

Usage

Initialize the Leaves

const Leaves = require('ulifyi-leaves');

const machineId = 1; // Your unique machine ID
const leaves = new Leaves(machineId);

Examples

Generate Leave ID

const Leaves = require('./leaves');

const machineId = 1;
const leaves = new Leaves(machineId);

for (let i = 0; i < 10; i++) {
  console.log(leaves.generateId());
}

API Reference

  • constructor(machineId: number): Initializes the Leaves instance with the provided machine ID.
  • generateId(): string: Generates a unique Leave ID.

Contributing

Contributions are welcome! Please feel free to submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details. node index.js

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published