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.

10 lines (9 loc) 286 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRandomBytes = getRandomBytes; const buffer_1 = require("buffer"); function getRandomBytes(length) { const buf = buffer_1.Buffer.alloc(length); crypto.getRandomValues(buf); return buf; }