Variable FORMATS

FORMATS: {
    alphabet: {
        config: {
            alphabet: string;
        };
        format(ex: DecimalSource, acc?: number, max?: number, type?: FormatType, start?: DecimalSource, startDouble?: boolean, abbStart?: number): string;
        getAbbreviation(ex: DecimalSource, start?: DecimalSource, startDouble?: boolean, abbStart?: number): string;
    };
    elemental: {
        config: {
            element_lists: string[][];
        };
        abbreviationLength(group: number): number;
        beyondOg(x: number): string;
        format(value: Decimal, acc?: number): string;
        formatElementalPart(abbreviation: string, n: Decimal): string;
        getAbbreviation(group: number, progress: number): string;
        getAbbreviationAndValue(x: Decimal): [string, Decimal];
        getOffset(group: number): number;
    };
    eng: {
        format(ex: DecimalSource, acc?: number): string;
    };
    inf: {
        format(ex: DecimalSource, acc?: number, max?: number): string;
    };
    layer: {
        layers: string[];
        format(ex: DecimalSource, acc?: number, max?: number): string;
    };
    mixed_sc: {
        format(ex: DecimalSource, acc?: number, max?: number): string;
    };
    old_sc: {
        format(ex: DecimalSource, acc: number): string;
    };
    omega: {
        config: {
            greek: string;
            infinity: string;
        };
        format(value: DecimalSource): string;
    };
    omega_short: {
        config: {
            greek: string;
            infinity: string;
        };
        format(value: DecimalSource): string;
    };
    standard: {
        tier1(x: number): string;
        tier2(x: number): string;
    };
}

Type declaration

  • alphabet: {
        config: {
            alphabet: string;
        };
        format(ex: DecimalSource, acc?: number, max?: number, type?: FormatType, start?: DecimalSource, startDouble?: boolean, abbStart?: number): string;
        getAbbreviation(ex: DecimalSource, start?: DecimalSource, startDouble?: boolean, abbStart?: number): string;
    }

    Alphabet format

    • config: {
          alphabet: string;
      }
      • alphabet: string
    • format:function
      • Format the value into alphabet format (a, b, c, ..., z, aa, ab, ac, ... aaa, aab, ... aaaa, ... aaaaaaaaaaaaaaa, ... aaaaaaaaaaaaaaa(2), aaaaaaaaaaaaaaa(3), ...) Basically base 26 for the exponential part / 3 Work in progress

        Parameters

        • ex: DecimalSource

          The value to format

        • acc: number = 2

          The accuracy

        • max: number = 9

          The maximum value before switching to an abbreviation

        • type: FormatType = "mixed_sc"

          The type of format to use

        • start: DecimalSource = ...

          The starting value. Defaults to 1e15, or 1 quadrillion.

        • startDouble: boolean = false

          Whether to start at aa instead of a. Defaults to false.

        • OptionalabbStart: number

          The starting value for abbreviations. Defaults to 9.

        Returns string

        • The formatted value
    • getAbbreviation:function
      • Get the abbreviation for a number

        Parameters

        • ex: DecimalSource

          The value to get the abbreviation for

        • start: DecimalSource = ...

          The starting value

        • startDouble: boolean = false

          Whether to start at aa instead of a

        • abbStart: number = 9

          The starting value for abbreviations

        Returns string

        • The abbreviation
  • elemental: {
        config: {
            element_lists: string[][];
        };
        abbreviationLength(group: number): number;
        beyondOg(x: number): string;
        format(value: Decimal, acc?: number): string;
        formatElementalPart(abbreviation: string, n: Decimal): string;
        getAbbreviation(group: number, progress: number): string;
        getAbbreviationAndValue(x: Decimal): [string, Decimal];
        getOffset(group: number): number;
    }
    • config: {
          element_lists: string[][];
      }
      • element_lists: string[][]

        The list of elements

    • abbreviationLength:function
      • Parameters

        • group: number

        Returns number

    • beyondOg:function
      • Parameters

        • x: number

        Returns string

    • format:function
    • formatElementalPart:function
      • Parameters

        Returns string

    • getAbbreviation:function
      • Parameters

        • group: number
        • progress: number

        Returns string

    • getAbbreviationAndValue:function
    • getOffset:function
      • Parameters

        • group: number

        Returns number

  • eng: {
        format(ex: DecimalSource, acc?: number): string;
    }

    Engineering format

    • format:function
      • Format the value into engineering format

        Parameters

        • ex: DecimalSource

          The value to format

        • acc: number = 2

          The accuracy

        Returns string

        • The formatted value
        console.log(FORMATS.eng.format(1e20, 2)); // 100.00e18
        
  • inf: {
        format(ex: DecimalSource, acc?: number, max?: number): string;
    }

    Infinity format

    • format:function
  • layer: {
        layers: string[];
        format(ex: DecimalSource, acc?: number, max?: number): string;
    }

    Layer format

    • layers: string[]
    • format:function
  • mixed_sc: {
        format(ex: DecimalSource, acc?: number, max?: number): string;
    }

    Mixed scientific format

    • format:function
      • Format the value into mixed scientific format (standard or scientific depending on the value)

        Parameters

        • ex: DecimalSource

          The value to format

        • Optionalacc: number

          The accuracy

        • max: number = 9

          The maximum value

        Returns string

        • The formatted value
        console.log(FORMATS.mixed_sc.format(1e20, 2, 9)); // 100.00 Qt
        console.log(FORMATS.mixed_sc.format(1e400, 2, 303)); // 1.00e400
  • old_sc: {
        format(ex: DecimalSource, acc: number): string;
    }

    Old scientific format

    • format:function
      • Format the value into old scientific format

        Parameters

        Returns string

        • The formatted value
  • omega: {
        config: {
            greek: string;
            infinity: string;
        };
        format(value: DecimalSource): string;
    }

    Omega format

    • config: {
          greek: string;
          infinity: string;
      }
      • greek: string
      • infinity: string
    • format:function
      • Format the value into omega format

        Parameters

        Returns string

        • The formatted value
  • omega_short: {
        config: {
            greek: string;
            infinity: string;
        };
        format(value: DecimalSource): string;
    }

    Short omega format

    • config: {
          greek: string;
          infinity: string;
      }
      • greek: string
      • infinity: string
    • format:function
      • Format the value into short omega format

        Parameters

        Returns string

        • The formatted value
  • standard: {
        tier1(x: number): string;
        tier2(x: number): string;
    }

    Standard (letter abbv) format

    • tier1:function
      • Gets the letter abbreviation for a number (e.g. 1 -> K) (0-1e3000)

        Parameters

        • x: number

          The number to get the letter abbreviation for

        Returns string

        • The letter abbreviation
    • tier2:function
      • Gets the tier 2 letter abbreviation for a number (e.g. 1 -> Mi) (1e3000+)

        Parameters

        • x: number

          The number to get the letter abbreviation for

        Returns string

        • The letter abbreviation