From a8d29646fd3c3d41bd30feaca891f8ed11d5a2ae Mon Sep 17 00:00:00 2001 From: Teodor Lagerqvist Date: Tue, 29 Oct 2019 10:28:48 +0100 Subject: [PATCH] fix(project): update interface --- src/module/interfaces/ngx-linkifyjs.interface.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/module/interfaces/ngx-linkifyjs.interface.ts b/src/module/interfaces/ngx-linkifyjs.interface.ts index d2d00d88..7ca6ed6c 100644 --- a/src/module/interfaces/ngx-linkifyjs.interface.ts +++ b/src/module/interfaces/ngx-linkifyjs.interface.ts @@ -18,7 +18,15 @@ export interface NgxLinkifyOptions { nl2br?: boolean, tagName?: string, target?: { url: string }, - validate?: boolean, + validate?: NgxLinkifyOptionsValidator, format?(value: any, type: any): any, formatHref?(href: any, type: any): any, } + +export type NgxLinkifyOptionsValidator = boolean | validatorFunction | validatorObject +type validatorFunction = (value: string, type?: "url" | "email") => boolean +type validatorTypeFunction = (value: string) => boolean +interface validatorObject { + url?: validatorTypeFunction + email?: validatorTypeFunction +}