A floating point number

Example

const float1     = Float.create(42.69, { name: 'MyFloat' });
const intFloat = Float.create(42);
const rangeFloat = Float.create(21.4, { min: 12.1, max: 41.9 });

// extract the Result:
if (float1.isSuccess()) {
console.log(float1.getValue()) // Float { _value: 42.69 }
}

Fails

  • if not a valid number
  • if the value is not inside the interval

Hierarchy

Accessors

Methods

  • compares 2 Lists of ValueObjects / values on equality

    Returns

    true if the lists are equal

    Type Parameters

    • ValueType

    Parameters

    • a: ValueObject<ValueType>[]

      the list of ValueObjects to compare with

    • b: ValueObject<ValueType>[] | ValueType[]

      a list of ValueObjects / values for comparison

    Returns boolean

  • Returns

    the value if the validation was successful

    Fails

    if not a valid number

    Fails

    if the value is not inside the interval

    Parameters

    • value: number

      to be validated as a float with the corresponding constraints (options)

    • Optional options: FloatOptions

      constraints the value has to fulfill

    Returns Result<number>

Generated using TypeDoc