@adonisjs/lucid-slugify
Version:
Generate and persist unique slugs in your database via Lucid models
19 lines (18 loc) • 583 B
TypeScript
import type { LucidRow } from '@adonisjs/lucid/types/model';
import type { SlugifyStrategyContract } from '../types.js';
/**
* The ShortIdStrategy creates unique slugs by appending a nanoid
* at the end of the slug value
*/
export declare class ShortIdStrategy implements SlugifyStrategyContract {
#private;
maxLengthBuffer: number;
constructor(config: {
separator?: string;
});
/**
* Converts an existing slug to a unique slug by appending
* nanoid to it
*/
makeSlugUnique(_: LucidRow, __: string, slug: string): Promise<string>;
}