UNPKG

@fidaktk/ids

Version:

A lightweight, dependency-efficient ID generator package for Node.js and web projects. Supports BSON `ObjectId` (compatible with MongoDB/Mongoose), UUIDv4/v5, CUID2, and URL-safe slug IDs.

13 lines (12 loc) 521 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.slug = exports.cuidId = void 0; const slugid_1 = __importDefault(require("slugid")); const cuid2_1 = require("@paralleldrive/cuid2"); const cuidId = () => (0, cuid2_1.createId)(); // secure, 24-character ID exports.cuidId = cuidId; const slug = () => slugid_1.default.nice(); exports.slug = slug;