Skip to main content

IFormatter<T>

Interface

Definition of a formatter

Type parameters

Name
T

Methods

format

Whatever the input type, formats the data following a certain logic and return that value as a string

Signature

format(value?: T, options?: FormatterFormatOptions) => string

Parameters

NameType
value?T
options?FormatterFormatOptions

Returns

string


parse

Optional

Check if the input value satisfies the logic and return either an error or the result of the parsing

Signature

parse(value: string, options?: FormatterParseOptions) => ErrorFormatterParseResult | SuccessFormatterParseResult<T>

Parameters

NameType
valuestring
options?FormatterParseOptions

Returns

ErrorFormatterParseResult | SuccessFormatterParseResult<T>