1.4.0 • Published 2 years ago
@ministry/id v1.4.0
Common unique ID utilities:
import { id, IdSchema, type Id } from "@ministry/id";
// Generate ids
id(); // "pfh0haxfpzowht3oi213cqos"
id("user"); // "user_pfh0haxfpzowht3oi213cqos"
// Validate ids
IdSchema().parse("any random string will work");
IdSchema("user").parse("user_ ensure string starts with supplied prefix");
// Opaque type
id() satisfies Id;