The denominator parsed or calculated if this is a fraction, otherwise this will be equal to 1.
The group determined based on the unit.
The numerator parsed or calculated if this is a fraction, otherwise this will be equal to Value.value.
The unit parsed or chosen for rate to be output to the user.
The group determined based on the rate.
The unit parsed or chosen to be output to the user.
The number parsed or num / den if a fraction was parsed.
A value instance which contains invalid numbers.
Returns the number which represents the fraction in the value. There may be a difference between this value and the number when the fraction is calculated from the denominators of the group.
Returns the ceiling of the number in this value.
Returns the number of this value relative to the first base unit of it's class.
Returns the absolute distance the number of this value is from the fraction numerator and denominator determined. If this value is not a fraction then this should return zero.
Returns the signed distance the number of this value is from the fraction numerator and denominator determined. If this value is not a fraction then this should return zero.
Returns the floor of the number in this value.
Returns true if this value is a number and not a fraction.
Returns true if this value is a fraction with a numerator and denoninator.
Returns true if this value is a rate.
Returns true if this value is singular.
Returns true if this value was successfully parsed from some input.
Returns true if this value is zero.
Returns the numerator for the mixed fraction of this value. If this value is not a fraction then the numerator is returned.
Returns the whole number for the mixed fraction of this value. If this value is not a fraction 0 is returned.
Returns the fractional part of the number in this value.
Returns the number of this value relative to the base unit.
Returns the truncated number in this value taking into account it's sign.
Calculates the sum of this value and the given addend scaled by some
factor. This is equivalent to result = this + (addend * scale)
.
The value to add to this.
The factor to scale the addend by before adding it to this.
A new instance.
Determines the available conversions of this value for all groups that are valid for the given transform.
Transform which controls the units and values acceptable.
Whether to iterate from largest units to smallest units
(true
), or from smallest to largest (false
).
The function to invoke for each valid conversion.
The conversion calculated.
The index of the conversion during iteration.
Returns a copy of this value.
A new value.
Returns a version of this value as a fraction.
A new value or the reference to this instance if it's a fraction.
Calculates the scale necessary to switch this value from the current rate to the provided rate.
The rate group.
The calculated scale.
Determines whether the given value is compatible with this value to perform operations with.
The value to test against.
True if the given value has compatible unit and rate groups.
Returns a value based on this value with the unit that best represents the value. What is best is typically related to the magnitude of the value. Really small and really large values are harder for people to comprehend so the unit which results in the most normal looking value is determined.
Transform which controls the units and values acceptable.
The output that may be used so the most normal looking value can be determined.
The most normal value found.
Returns a version of this value as a number.
A new value or the reference to this instance if it's a number.
Converts this value to a string with the given output options taking into account the global options.
The options to override the global output options.
The string representation of this instance.
Returns a version of this value with the preferred unit.
A new value or the reference to this instance if it's groupless.
Calculates a new value by multiplying this by a given factor. This is
equivalent to result = this * scale
.
The factor to scale this instance by.
A new instance.
Calculates the difference between this value and the subtrahend scaled by
some factor. This is equivalent to result = this - (subtrahend * scale)
.
The value to subtract from this.
The factor to scale the subtrahend by before subtraction.
A new instance.
Returns the truncated version of this value. That's a value where the number is a whole number.
A new value.
Returns the units of this value as a string based on the global output options.
The options to override the global output options.
The string representation of the units of this value.
Returns a value equivalent to zero with the unt and group of this instance.
A new value.
Returns a Value instance for a given fraction specified by a numerator and denominator.
The numerator of the fraction.
The denominator of the fraction.
The unit, if any, of the fraction.
The group which matches the unit.
A new instance.
Returns a Value instance which is a number with the optional unit and group.
The number.
The unit, if any, of the number.
The group which matches the unit.
A new instance.
Returns a Value instance which tries to be a fraction based on the denominators of the group. If a valid fraction could not be found then the instance returned will be a number value. Since a unit is not passed here, the preferred unit of the group is used as the unit of the value.
The number to try to find a fraction for.
The group for the unit and also the denominators to try.
The group for the rate.
A new instance.
Returns a Value instance which tries to be a fraction based on the denominators of the group. If a valid fraction could not be found then the instance returned will be a number value.
The number to try to find a fraction for.
The array of denominators to try.
The unit, if any, of the number.
The group which matches the unit.
A new instance.
Returns a Value instance which tries to be a fraction given a range of denominators. If the number is already whole or a fraction close enough to the number cannot be found a value which is a number is returned.
The number to try to find a fraction for.
The unit, if any, of the number.
The group which matches the unit.
The starting denominator to inclusively try.
The last denominator to inclusively try.
A new instance.
Generated using TypeDoc
A class which contains a parsed number or fraction.