feature: .all() to iterate over all objects in a collection

This commit is contained in:
Andy Burke 2025-06-27 12:56:29 -07:00
parent bf2bec0c3d
commit 56715a1400
5 changed files with 147 additions and 5 deletions

View file

@ -14,10 +14,10 @@ const TLDs: string[] = [
const random_byte_buffer: Uint8Array = new Uint8Array(3);
export function random_email_address(): string {
crypto.getRandomValues(random_byte_buffer);
for (let i: number = 0; i < random_byte_buffer.length; ++i) random_byte_buffer[i] = Math.floor(Math.random() * 256);
const name = convert_to_words(random_byte_buffer).join('-');
crypto.getRandomValues(random_byte_buffer);
for (let i: number = 0; i < random_byte_buffer.length; ++i) random_byte_buffer[i] = Math.floor(Math.random() * 256);
const domain = convert_to_words(random_byte_buffer).join('-');
const tld = TLDs[Math.floor(Math.random() * TLDs.length)];
@ -25,7 +25,7 @@ export function random_email_address(): string {
}
export function random_username(): string {
crypto.getRandomValues(random_byte_buffer);
for (let i: number = 0; i < random_byte_buffer.length; ++i) random_byte_buffer[i] = Math.floor(Math.random() * 256);
return convert_to_words(random_byte_buffer).join('-');
}