Format Class @beta
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 | |
| fromFullyResolvedJSON(jsonObj: ResolvedFormatProps): void | ||
| fromJSON(unitsProvider: UnitsProvider, jsonObj: FormatProps): Promise<void> | Populates this Format with the values from the provided. | |
| toFullyResolvedJSON(): ResolvedFormatProps | ||
| toJSON(): FormatProps | Returns a JSON object that contain the specification for this Format. | |
| createFromFullyResolvedJSON(name: string, formatProps: ResolvedFormatProps): Format Static | ||
| 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 | ResolvedFormatProps): 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 | |
| _stationBaseFactor Protected Inherited | number | undefined | 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 | |
| stationBaseFactor Accessor Inherited | undefined | number | BaseFormat | Gets the station base factor used for station formatting. This is a positive integer that acts as a multiplier for the base offset calculation. The default value is 1. |
| 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 257
Last Updated: 28 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.