From fe0b8a780a10624bee0ed678eb61a1cf81be1043 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 14 Apr 2026 19:08:12 +0100 Subject: [PATCH] feat: add `base64id` to replacements --- manifests/micro-utilities.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/manifests/micro-utilities.json b/manifests/micro-utilities.json index 97dc36e..61ea2d0 100644 --- a/manifests/micro-utilities.json +++ b/manifests/micro-utilities.json @@ -66,6 +66,12 @@ "description": "Every modern runtime provides a way to convert byte array to and from base64.", "example": "// From base64 to Uint8Array\nconst bytes = Uint8Array.fromBase64(base64)\n// From Uint8Array to base64\nconst base64 = bytes.toBase64()" }, + "snippet::base64-id": { + "id": "snippet::base64-id", + "type": "simple", + "description": "You can use `crypto.randomBytes` with `Buffer.prototype.toString` to generate a random base64 id", + "example": "import crypto from 'node:crypto'\nconst id = crypto.randomBytes(15).toString('base64').replaceAll('+', '-').replaceAll('/', '_')" + }, "snippet::call-bind": { "id": "snippet::call-bind", "type": "simple", @@ -402,6 +408,11 @@ "moduleName": "base64-js", "replacements": ["snippet::base64"] }, + "base64id": { + "type": "module", + "moduleName": "base64id", + "replacements": ["snippet::base64-id"] + }, "call-bind": { "type": "module", "moduleName": "call-bind",