# new NameFmt(options)
Parameters:
Name | Type | Description |
---|---|---|
options |
Object
|
A set of options that govern how the formatter will behave |
Methods
# format(name) → {string|undefined}
Format the name for display in the current locale with the options set up in the constructor of this formatter instance.
If the name does not contain all the parts required for the style, those parts will be left blank.
There are two basic styles of formatting: European, and Asian. If this formatter object is set for European style, but an Asian name is passed to the format method, then this method will format the Asian name with a generic Asian template. Similarly, if the formatter is set for an Asian style, and a European name is passed to the format method, the formatter will use a generic European template.
This means it is always safe to format any name with a formatter for any locale. You should always get something at least reasonable as output.
Parameters:
Name | Type | Description |
---|---|---|
name |
Name
|
Object
|
the name instance to format, or an object containing name parts to format |
the name formatted according to the style of this formatter instance
string
|
undefined
# getComponents() → {string}
Return the list of components used to format names in this formatter
the list of components
string
# getLocale() → {Locale}
Return the locale for this formatter instance.
the locale instance for this formatter
# getStyle() → {string}
Return the style of names returned by this formatter
the style of names returned by this formatter
string