UNPKG

@necto/id

Version:

Necto's library for generating algorithmic ID's based on specified parameters.

2 lines 315 B
import m from"randombytes";import{ALPHABET as t}from"@necto/constants";function f(r=21,o=Array.from([...t.LOWERCASE,...t.CAPITALIZED])){if(r<=0)throw new Error("Length must be a positive integer.");let n=o.length,e=m(r);return Array.from(e).map(i=>o[i%n]).join("")}export{f as id}; //# sourceMappingURL=index.js.map