function uniqueSlug
uniqueSlug(
db: DatabaseSync,
kind: SlugKind,
userId: string,
base: string
): string

Returns base, or base-2, base-3… cut to fit, whichever is free in userId's space for kind. base must be a valid slug, as slugify makes. The services take it on creating an item, the migration on re-slugging one, inside the transaction that writes it.

Parameters

db: DatabaseSync
userId: string
base: string

Return Type

string

Usage

import { uniqueSlug } from "api/lib/slugify.ts";