From 8745ad5899d5a96484a4c2f1b14a5cb6b938ba02 Mon Sep 17 00:00:00 2001 From: DouglasGabr Date: Mon, 7 Jun 2021 15:21:53 -0300 Subject: [PATCH] Improve types --- slugify.d.ts | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/slugify.d.ts b/slugify.d.ts index ade1592..631886c 100644 --- a/slugify.d.ts +++ b/slugify.d.ts @@ -1,23 +1,43 @@ declare module slugify { type ExtendArgs = { [key: string]: any; - } + }; - export function extend (args: ExtendArgs): void; + export function extend(args: ExtendArgs): void; } +/** + * @param string + * @param replacement replace spaces with replacement character, defaults to `-` + */ +declare function slugify(string: string, replacement?: string): string; declare function slugify( string: string, - options?: - | { - replacement?: string; - remove?: RegExp; - lower?: boolean; - strict?: boolean; - locale?: string; - } - | string, - + options?: { + /** + * replace spaces with replacement character + * @default '-' + */ + replacement?: string; + /** + * remove characters that match regex + */ + remove?: RegExp; + /** + * convert to lower case + * @default false + */ + lower?: boolean; + /** + * strip special characters except replacement + * @default false + */ + strict?: boolean; + /** + * language code of the locale to use + */ + locale?: string; + } ): string; export default slugify;