UNPKG

alistair

Version:
12 lines (9 loc) 341 B
// Copyright 2026 Alistair Smith https://github.com/alii/alistair // src/id/index.ts function id(length = 20, alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") { return [...new Array(length)].reduce( (str) => str + alphabet.charAt(Math.floor(Math.random() * alphabet.length)), "" ); } export { id };