UNPKG

alistair

Version:
14 lines (10 loc) 358 B
'use strict'; // Copyright 2025 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)), "" ); } exports.id = id;