Variable NumbersConst

Numbers: {
    comparator: {
        asc: ((a, b) => number);
        desc: ((a, b) => number);
        valueAsc: (<T>(extractor) => ((a, b) => number));
        valueDesc: (<T>(extractor) => ((a, b) => number));
    };
    formatter: {
        float: ((float?, options?) => string);
        floatWithDecimal: ((float?, options?) => string);
        integer: ((integer, options?) => string);
        large: ((value, options?) => string);
        percentage: ((percentage, options?) => string);
    };
    helper: {
        average: ((numbers, rounded?) => number);
        random: ((min, max) => number);
    };
} = ...

Type declaration

  • comparator: {
        asc: ((a, b) => number);
        desc: ((a, b) => number);
        valueAsc: (<T>(extractor) => ((a, b) => number));
        valueDesc: (<T>(extractor) => ((a, b) => number));
    }

    Number comparators.

    • asc: ((a, b) => number)

      An ascendent number comparator.

        • (a, b): number
        • An ascendent number comparator.

          Parameters

          • a: number
          • b: number

          Returns number

    • desc: ((a, b) => number)

      An descendent number comparator.

        • (a, b): number
        • An descendent number comparator.

          Parameters

          • a: number
          • b: number

          Returns number

    • valueAsc: (<T>(extractor) => ((a, b) => number))

      An ascendent number comparator from extracted values.

        • <T>(extractor): ((a, b) => number)
        • An ascendent number comparator from extracted values.

          Type Parameters

          • T

          Parameters

          Returns ((a, b) => number)

            • (a, b): number
            • Parameters

              Returns number

    • valueDesc: (<T>(extractor) => ((a, b) => number))

      An descendent number comparator from extracted values.

        • <T>(extractor): ((a, b) => number)
        • An descendent number comparator from extracted values.

          Type Parameters

          • T

          Parameters

          Returns ((a, b) => number)

            • (a, b): number
            • Parameters

              Returns number

  • formatter: {
        float: ((float?, options?) => string);
        floatWithDecimal: ((float?, options?) => string);
        integer: ((integer, options?) => string);
        large: ((value, options?) => string);
        percentage: ((percentage, options?) => string);
    }

    Number formatters.

    • float: ((float?, options?) => string)

      Formats the given number into a float string representation. No decimal will be displayed of not needed.

      Param: percentage

      The number to format.

      Param: options

      The formatter options.

      Returns

      either a float or integer string representation of the given number.

        • (float?, options?): string
        • Formats the given number into a float string representation. No decimal will be displayed of not needed.

          Parameters

          Returns string

          either a float or integer string representation of the given number.

    • floatWithDecimal: ((float?, options?) => string)

      Formats the given number into a float string representation with forced decimal.

      Param: percentage

      The number to format.

      Param: options

      The formatter options.

      Returns

      a float string representation of the given number.

        • (float?, options?): string
        • Formats the given number into a float string representation with forced decimal.

          Parameters

          Returns string

          a float string representation of the given number.

    • integer: ((integer, options?) => string)

      Formats the given number into a integer string representation.

      Param: percentage

      The number to format.

      Param: options

      The formatter options.

      Returns

      either a float or integer string representation of the given number.

        • (integer, options?): string
        • Formats the given number into a integer string representation.

          Parameters

          Returns string

          either a float or integer string representation of the given number.

    • large: ((value, options?) => string)

      Formats the given number into a string representation handling thousand separators.

      Param: value

      The number to format.

      Param: options

      The formatter options.

      Returns

      the string representation of the given number.

        • (value, options?): string
        • Formats the given number into a string representation handling thousand separators.

          Parameters

          Returns string

          the string representation of the given number.

    • percentage: ((percentage, options?) => string)

      Formats the given number into a percentage string representation.

      Param: percentage

      The number to format.

      Param: options

      The formatter options.

      Returns

      a percentage string representation of the given number.

        • (percentage, options?): string
        • Formats the given number into a percentage string representation.

          Parameters

          • percentage: number

            The number to format.

          • Optional options: INumberFormatOptions

            The formatter options.

          Returns string

          a percentage string representation of the given number.

  • helper: {
        average: ((numbers, rounded?) => number);
        random: ((min, max) => number);
    }

    Number helper methods.

    • average: ((numbers, rounded?) => number)

      Calculates the average of all numbers given in the array.

      Param: numbers

      The numbers to be averaged.

      Param: rounded

      whether the result average should be rounded.

      Returns

      the average result.

        • (numbers, rounded?): number
        • Calculates the average of all numbers given in the array.

          Parameters

          • numbers: number[]

            The numbers to be averaged.

          • rounded: boolean = false

            whether the result average should be rounded.

          Returns number

          the average result.

    • random: ((min, max) => number)

      Returns a random number contained between the given mion and max values inclusively.

      Param: min

      The min value.

      Param: max

      The max value.

      Returns

      the result random number.

        • (min, max): number
        • Returns a random number contained between the given mion and max values inclusively.

          Parameters

          • min: number

            The min value.

          • max: number

            The max value.

          Returns number

          the result random number.

Generated using TypeDoc