Module: runtime/mci/formatters
Format Modifiers
Summary
Synchronet-style format modifiers (L/R/C/Z/W/T/U)
Table of contents
Interfaces
Type Aliases
Functions
- addThousandsSeparator
- applyFormat
- center
- leftJustify
- padToVisibleWidth
- parseFormatModifier
- rightJustify
- stripAnsi
- toFullWidth
- toHalfWidth
- truncate
- visibleLength
- zeroPad
Type Aliases
FormatModifier
Ƭ FormatModifier: "L" | "R" | "C" | "Z" | "W" | "T" | "U" | ">"
Defined in
Functions
addThousandsSeparator
▸ addThousandsSeparator(text, separator?): string
Parameters
| Name | Type | Default value |
|---|---|---|
text |
string |
undefined |
separator |
string |
"," |
Returns
string
Defined in
core/src/mci/formatters.ts:128
applyFormat
▸ applyFormat(value, options): string
Parameters
| Name | Type |
|---|---|
value |
string |
options |
FormatOptions |
Returns
string
Defined in
center
▸ center(text, width): string
Parameters
| Name | Type |
|---|---|
text |
string |
width |
number |
Returns
string
Defined in
core/src/mci/formatters.ts:105
leftJustify
▸ leftJustify(text, width): string
Parameters
| Name | Type |
|---|---|
text |
string |
width |
number |
Returns
string
Defined in
padToVisibleWidth
▸ padToVisibleWidth(text, width, align?): string
Parameters
| Name | Type | Default value |
|---|---|---|
text |
string |
undefined |
width |
number |
undefined |
align |
"left" | "right" | "center" |
"left" |
Returns
string
Defined in
core/src/mci/formatters.ts:270
parseFormatModifier
▸ parseFormatModifier(codeWithModifier): ParsedFormat
Parameters
| Name | Type |
|---|---|
codeWithModifier |
string |
Returns
Defined in
rightJustify
▸ rightJustify(text, width): string
Parameters
| Name | Type |
|---|---|
text |
string |
width |
number |
Returns
string
Defined in
stripAnsi
▸ stripAnsi(text): string
Parameters
| Name | Type |
|---|---|
text |
string |
Returns
string
Defined in
core/src/mci/formatters.ts:262
toFullWidth
▸ toFullWidth(text): string
Parameters
| Name | Type |
|---|---|
text |
string |
Returns
string
Defined in
core/src/mci/formatters.ts:235
toHalfWidth
▸ toHalfWidth(text): string
Parameters
| Name | Type |
|---|---|
text |
string |
Returns
string
Defined in
core/src/mci/formatters.ts:243
truncate
▸ truncate(text, maxLength, ellipsis?): string
Parameters
| Name | Type | Default value |
|---|---|---|
text |
string |
undefined |
maxLength |
number |
undefined |
ellipsis |
string |
"..." |
Returns
string
Defined in
core/src/mci/formatters.ts:256
visibleLength
▸ visibleLength(text): number
Parameters
| Name | Type |
|---|---|
text |
string |
Returns
number
Defined in
core/src/mci/formatters.ts:266
zeroPad
▸ zeroPad(text, width): string
Parameters
| Name | Type |
|---|---|
text |
string |
width |
number |
Returns
string