Formatter

No summary available

Import
the javascript logo
import { Formatter } from "@schukai/monster/source/text/formatter.mjs";
Source
the git logo
Package
the npm logo
Since
1.12.0

/** this example does not use an extra script **/

Exported

Formatter

Derived from

BaseWithOptions

Options

The Options listed in this section are defined directly within the class. This class is derived from several parent classes. Therefore, it inherits Options from these parent classes. If you cannot find a specific Options in this list, we recommend consulting the documentation of the BaseWithOptions.

Option
Type
Default
Description
object
marker
array
marker.open=["${"]
array
marker.close=["${"]
object
parameter
string
parameter.delimiter="::"
string
parameter.assignment="="
object
callbacks={}

Properties

The Properties listed in this section are defined directly within the class. This class is derived from several parent classes. Therefore, it inherits Properties from these parent classes. If you cannot find a specific Properties in this list, we recommend consulting the documentation of the BaseWithOptions.

Methods

The methods listed in this section are defined directly within the class. This class is derived from several parent classes. Therefore, it inherits methods from these parent classes. If you cannot find a specific method in this list, we recommend consulting the documentation of the BaseWithOptions.

Constructor

constructor(object,options)
Parameters
  • object: object
  • options: options
Default values for the markers are ${ and }

Structural methods

setMarker(open,close)1.12.0
Parameters
  • open {array|string}: open
  • close {array|string|undefined}: close
Returns
  • {Formatter}
Throws
  • {TypeError} value is not a string
Set new Marker Default values for the markers are ${ and } ``formatter.setMarker('#'); // open and close are both # formatter.setMarker('[',']'); formatter.setMarker('i18n{','}');``
setParameterChars(delimiter,assignment)1.24.0
Parameters
  • delimiter {string}: delimiter
  • assignment {string}: assignment
Returns
  • {Formatter}
Throws
  • {TypeError} value is not a string
Set new Parameter Character Default values for the chars are :: and = ``formatter.setParameterChars('#'); formatter.setParameterChars('[',']'); formatter.setParameterChars('i18n{','}');``

Other methods

format(text)
Parameters
  • text {string}: text
Returns
  • {string}
Throws
  • {TypeError} value is not a string
  • {Error} too deep nesting

Events

This component does not fire any public events. It may fire events that are inherited from its parent classes.

The current width of the area is too small to display the content correctly.