Caplin Trader 4.5.2

Class: module:caplin/element/formatter/InvalidPriceFormatter

module:caplin/element/formatter/InvalidPriceFormatter

Constructor

new module:caplin/element/formatter/InvalidPriceFormatter()

Substitutes a token for the value if it is not a valid price.

InvalidPriceFormatter is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example which evaluates to "-":

caplin.element.formatter.InvalidPriceFormatter.format("0", {invalidPrice:"-"})
Implements:

Methods

format(vValue, mAttributes) → {String}

Substitutes a token for the value if it is not a valid price (a positive number).
Parameters:
Name Type Description
vValue Variant the price (String or Number type).
mAttributes Map the map of attributes.
Properties
Name Type Attributes Default Description
invalidPrice String <optional>
'' the replacement text in case of an invalid price.
Returns:
the replacement text in case of an invalid price, otherwise the unchanged price.
Type
String