alphabet()
Generates a string with all the characters defined in the provided pattern:
a-z:abcdefghijklmnopqrstuvwxyzA-Z:ABCDEFGHIJKLMNOPQRSTUVWXYZ0-9:0123456789-: Character-_: Character_
Mostly used for generateRandomString(). Ignores duplicate patterns.
Definition
function alphabet(...patterns: "a-z" | "A-Z" | "0-9" | "-" | "_"): string;
Parameters
patterns
Example
import { alphabet } from "oslo/crypto";
// "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
alphabet("a-z", "A-Z", "0-9");
// "0123456789"
alphabet("0-9", "0-9");