Format Class
A class used to define the specifications for formatting quantity values. This class is typically loaded by reading FormatProps.
Extends
Methods
Name | Description | |
---|---|---|
constructor(name: string): Format | Constructor | |
clone(options?: CloneOptions): Format | Clone Format | |
fromJSON(unitsProvider: UnitsProvider, jsonObj: FormatProps): Promise<void> | Populates this Format with the values from the provided. | |
toJSON(): FormatProps | Returns a JSON object that contain the specification for this Format. | |
createFromJSON(name: string, unitsProvider: UnitsProvider, formatProps: FormatProps): Promise<Format> Static | Create a Format from FormatProps | |
isFormatTraitSetInProps(formatProps: FormatProps, trait: FormatTraits): boolean Static |
Inherited methods
Name | Inherited from | Description |
---|---|---|
hasFormatTraitSet(formatTrait: FormatTraits): boolean Inherited | BaseFormat | This method returns true if the formatTrait is set in this Format object. |
loadFormatProperties(formatProps: FormatProps): void Inherited | BaseFormat | |
parseFormatTraits(formatTraitsFromJson: string | string[]): void Inherited | BaseFormat | This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid FormatType. |
Properties
Name | Type | Description | |
---|---|---|---|
_customProps Protected | any | undefined | ||
_units Protected | [UnitProps, undefined | string][] | undefined | ||
customProps Accessor ReadOnly | any | ||
hasUnits Accessor ReadOnly | boolean | ||
units Accessor ReadOnly | undefined | [UnitProps, undefined | string][] |
Inherited properties
Name | Type | Inherited from | Description |
---|---|---|---|
_allowMathematicOperations Protected Inherited | boolean | BaseFormat | |
_azimuthBase Protected Inherited | number | undefined | BaseFormat | |
_azimuthBaseUnit Protected Inherited | UnitProps | undefined | BaseFormat | |
_azimuthCounterClockwise Protected Inherited | boolean | undefined | BaseFormat | |
_decimalSeparator Protected Inherited | string | BaseFormat | |
_formatTraits Protected Inherited | FormatTraits | BaseFormat | |
_includeZero Protected Inherited | boolean | BaseFormat | |
_minWidth Protected Inherited | number | undefined | BaseFormat | |
_precision Protected Inherited | number | BaseFormat | |
_ratioType Protected Inherited | RatioType | undefined | BaseFormat | |
_revolutionUnit Protected Inherited | UnitProps | undefined | BaseFormat | |
_roundFactor Protected Inherited | number | BaseFormat | |
_scientificType Protected Inherited | ScientificType | undefined | BaseFormat | |
_showSignOption Protected Inherited | ShowSignOption | BaseFormat | |
_spacer Protected Inherited | string | BaseFormat | |
_stationOffsetSize Protected Inherited | number | undefined | BaseFormat | |
_stationSeparator Protected Inherited | string | BaseFormat | |
_thousandSeparator Protected Inherited | string | BaseFormat | |
_type Protected Inherited | FormatType | BaseFormat | |
_uomSeparator Protected Inherited | string | BaseFormat | |
allowMathematicOperations Accessor Inherited | boolean | BaseFormat | |
azimuthBase Accessor Inherited | undefined | number | BaseFormat | |
azimuthBaseUnit Accessor Inherited | undefined | UnitProps | BaseFormat | |
azimuthClockwiseOrDefault Accessor Inherited ReadOnly | boolean | BaseFormat | |
azimuthCounterClockwise Accessor Inherited | undefined | boolean | BaseFormat | |
decimalSeparator Accessor Inherited | string | BaseFormat | |
formatTraits Accessor Inherited | FormatTraits | BaseFormat | |
includeZero Accessor Inherited | undefined | boolean | BaseFormat | |
minWidth Accessor Inherited | undefined | number | BaseFormat | |
name Accessor Inherited ReadOnly | string | BaseFormat | |
precision Accessor Inherited | DecimalPrecision | FractionalPrecision | BaseFormat | |
ratioType Accessor Inherited | undefined | RatioType | BaseFormat | |
revolutionUnit Accessor Inherited | undefined | UnitProps | BaseFormat | |
roundFactor Accessor Inherited | number | BaseFormat | |
scientificType Accessor Inherited | undefined | ScientificType | BaseFormat | |
showSignOption Accessor Inherited | ShowSignOption | BaseFormat | |
spacer Accessor Inherited | undefined | string | BaseFormat | |
spacerOrDefault Accessor Inherited ReadOnly | string | BaseFormat | |
stationOffsetSize Accessor Inherited | undefined | number | BaseFormat | |
stationSeparator Accessor Inherited | string | BaseFormat | |
thousandSeparator Accessor Inherited | string | BaseFormat | |
type Accessor Inherited | FormatType | BaseFormat | |
uomSeparator Accessor Inherited | string | BaseFormat |
Defined in
- quantity/src/Formatter/Format.ts Line 239
Last Updated: 14 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.