Class default<ConextType>

Source
Expand description

Class representing a message variable that can be replaced with a value from a given context.

Constructors§

Source§

new default<ConextType>(
    key: string | RegExp,
    valueSelector: (valueSource: ConextType) => string,
): default<ConextType>

Creates an instance of MessageVariable.

Properties§

§readonly key: string | RegExp

The key to be replaced in the message. It can be a string or a regular expression.

§private readonly valueSelector: { ... }

A function that selects the value from the given context.

Methods§

Source§

replaceInMessage(message: string, context: ConextType): string

Replaces the key in the message with the value selected from the context.