1.0.0 β€’ Published 4 months ago

numeric-uuid v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

Here’s your complete README.md for your numeric-uuid package:

# numeric-uuid

A simple and efficient numeric UUID generator for Node.js. This library generates unique numeric IDs based on the current timestamp and random digits, ensuring uniqueness while maintaining simplicity.

## πŸš€ Features

- Generates numeric UUIDs with a customizable length.
- Ensures uniqueness using the current timestamp.
- Supports lengths between **10** and **30** digits.
- Lightweight and dependency-free.

## πŸ“¦ Installation

Install via npm:

```bash
npm install numeric-uuid
```

πŸ”§ Usage

Import and Generate Numeric UUID

const NumericUUID = require("numeric-uuid");

// Generate a numeric UUID with the default length (20 digits)
const id1 = NumericUUID.generate();
console.log(id1); // Example: 17097012345678901234

// Generate a numeric UUID with a custom length (e.g., 25 digits)
const id2 = NumericUUID.generate(25);
console.log(id2); // Example: 1709701234567890123456789

Error Handling

If the provided length is less than 10 or greater than 30, an error will be thrown:

try {
  NumericUUID.generate(35); // Throws an error
} catch (error) {
  console.error(error.message); // Output: "Length must be between 10 and 30 digits."
}

πŸ“œ API Reference

NumericUUID.generate(length)

ParameterTypeDefaultDescription
lengthnumber20The length of the generated numeric UUID. Must be between 10 and 30.

Returns: A string representing a unique numeric UUID.

🌟 Why Use numeric-uuid?

  • βœ… Simple & Lightweight – No external dependencies.
  • βœ… Customizable Length – Choose between 10 to 30 digits.
  • βœ… Fast Performance – Uses timestamp-based uniqueness.
  • βœ… Great for Logging, Tracking, and IDs.

🀝 Connect with Me

πŸ“„ License

This project is licensed under the MIT License.

---

This README is **well-structured**, includes **installation**, **usage examples**, **error handling**, and **API reference**, along with your **GitHub and LinkedIn links**.

Let me know if you need any modifications! πŸš€
1.0.0

4 months ago