Merge branch 'main' into user-account

This commit is contained in:
Philipp Heckel 2022-12-08 11:43:21 -05:00
commit 2e1ddc9ae1
5 changed files with 75 additions and 27 deletions

View file

@ -249,3 +249,12 @@ export async function* fetchLinesIterator(fileURL, headers) {
yield chunk.substr(startIndex); // last line didn't end in a newline char
}
}
export const randomAlphanumericString = (len) => {
const alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
let id = "";
for (let i = 0; i < len; i++) {
id += alphabet[(Math.random() * alphabet.length) | 0];
}
return id;
}