You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I generate a CUID, the result is undefined${cuid}. I'm unsure why this is happening.
Reproduction
install typescript, ts-node, and this library using pnpm
Create index.ts with file under
Run using pnpm ts-node index.ts
import{assert}from'node:console';import{randomInt}from'node:crypto';import{init,isCuid}from'@paralleldrive/cuid2';constMAX_NUMBER=2**48-1;functionrandomNumber(): number{returnrandomInt(MAX_NUMBER);}exportconstcreateCuid=init({length: 12,random: randomNumber,fingerprint: 'api',});exportfunctioncuid(): string{constcuid=createCuid();assert(isCuid(cuid),'Generated CUID is not valid');assert(cuid.match(/undefined/)===null,'Generated CUID contains "undefined"',);returncuid.replace(/undefined/,'');}console.log(cuid());
Environment
node.js v20.15.0
pnpm 9.7.0
typescript
The text was updated successfully, but these errors were encountered:
Hello, wonderful library!
When I generate a CUID, the result is
undefined${cuid}
. I'm unsure why this is happening.Reproduction
pnpm ts-node index.ts
Environment
The text was updated successfully, but these errors were encountered: