MCPcopy
hub / github.com/zxlie/FeHelper / generateNanoId

Function generateNanoId

apps/uuid-gen/index.js:95–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93 }
94
95 function generateNanoId() {
96 var alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-';
97 var len = Math.min(Math.max(parseInt($('nanoIdLength').value) || 1, 1), 256);
98 var bytes = crypto.getRandomValues(new Uint8Array(len));
99 var id = '';
100 for (var i = 0; i < len; i++) {
101 id += alphabet[bytes[i] & 63];
102 }
103 return id;
104 }
105
106 function generateNanoIds() {
107 var count = Math.min(Math.max(parseInt($('nanoIdCount').value) || 1, 1), 100);

Callers 1

generateNanoIdsFunction · 0.85

Calls 1

$Function · 0.70

Tested by

no test coverage detected