Skip to content

Commit 4579976

Browse files
authored
feat: add base64id to replacements (#595)
1 parent 5417eb6 commit 4579976

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

manifests/micro-utilities.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666
"description": "Every modern runtime provides a way to convert byte array to and from base64.",
6767
"example": "// From base64 to Uint8Array\nconst bytes = Uint8Array.fromBase64(base64)\n// From Uint8Array to base64\nconst base64 = bytes.toBase64()"
6868
},
69+
"snippet::base64-id": {
70+
"id": "snippet::base64-id",
71+
"type": "simple",
72+
"description": "You can use `crypto.randomBytes` with `Buffer.prototype.toString` to generate a random base64 id",
73+
"example": "import crypto from 'node:crypto'\nconst id = crypto.randomBytes(15).toString('base64').replaceAll('+', '-').replaceAll('/', '_')"
74+
},
6975
"snippet::call-bind": {
7076
"id": "snippet::call-bind",
7177
"type": "simple",
@@ -402,6 +408,11 @@
402408
"moduleName": "base64-js",
403409
"replacements": ["snippet::base64"]
404410
},
411+
"base64id": {
412+
"type": "module",
413+
"moduleName": "base64id",
414+
"replacements": ["snippet::base64-id"]
415+
},
405416
"call-bind": {
406417
"type": "module",
407418
"moduleName": "call-bind",

0 commit comments

Comments
 (0)