Interface Formatter

A Formatter responsible to format values into a string. Each formatter has a unique id and is referenced by this id by a column. The interface FormattingInfoProvider is responsible to combine a column to a formatter.

The names of the options used to control the formatting in the format method must be disjunctive across all implemented Formatters.

NOTE: This interface is a proof of concept, please provide feedback if you try it.

A Formatter needs to be registered as provides: result-api.Formatter.

Example: Custom Formatter

export class UpperCaseFormatter implements Formatter {
id = "string-to-upper-case";

format(values: any[], options?: FormatterOptions): string {
return values.join("").toUpperCase();
}
interface Formatter {
    format(values, options?): string;
    id: string;
}

Properties

Methods

Properties

id: string

Identifier of a formatter.

Methods

  • Formats values into a string.

    Parameters

    • values: any[]

      values of any type. It is up to the configuration that a formatter is correct informed.

    • Optional options: FormatterOptions

      possible configuration flags for the formatter.

    Returns string

Generated using TypeDoc