Caplin Trader 5.1.0

Class: module:ct-element/formatter/NullValueFormatter

module:ct-element/formatter/NullValueFormatter()

new module:ct-element/formatter/NullValueFormatter()

Substitutes text when the value is null, undefined, or the empty string.

NullValueFormatter is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example which evaluates to "N/A":

NullValueFormatter.format("", {nullValue:"N/A"})
Implements:

Methods

format(vValue, mAttributes) → {String}

Substitutes replacement text when the string is void (null, undefined, or the empty string).

Parameters:
Name Type Description
vValue Variant

the string.

mAttributes Map

the map of attributes.

Properties
Name Type Attributes Default Description
nullValue String <optional>
''

the replacement text to substitute in case of a null string.

Implements:
Returns:

the replacement string in the case of a void, otherwise the unchanged string.

Type
String