generate-snowflake
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Generate Snowflake

Generate unique IDs. Inspired by Twitter's Snowflake system.

📦 Installation

  • Using yarn: yarn add generate-snowflake
  • Using npm: npm install generate-snowflake

🤓 Usage

// ES6
import { Snowlfake } from "generate-snowflake";

// CommonJS
const { Snowflake } = require("generate-snowflake");

// Initialize an instance
const EPOCH = Date.now(); // Your projects EPOCH
const snowflakeInstance = new Snowflake(EPOCH);

// Generate ID
const snowflake = snowflakeInstance.generate();

🧦 Contributing

Fell free to use GitHub's features.

Dependents (0)

Package Sidebar

Install

npm i generate-snowflake

Weekly Downloads

2

Version

0.0.1

License

GPL-3.0

Unpacked Size

88.5 kB

Total Files

7

Last publish

Collaborators

  • leydihavuc
  • ben_baris