How to use the @phensley/decimal.Chars.DIGIT2 function in @phensley/decimal

To help you get started, we’ve selected a few @phensley/decimal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phensley / cldr-engine / packages / cldr-core / src / systems / numbering / decimal.ts View on Github external
export const fastFormatDecimal = (n: string, digits: string[], minInt: number): string => {
  let r = '';
  const len = n.length;
  for (let i = 0; i < len; i++) {
    const c = n.charCodeAt(i);
    switch (c) {
      case Chars.DIGIT0:
      case Chars.DIGIT1:
      case Chars.DIGIT2:
      case Chars.DIGIT3:
      case Chars.DIGIT4:
      case Chars.DIGIT5:
      case Chars.DIGIT6:
      case Chars.DIGIT7:
      case Chars.DIGIT8:
      case Chars.DIGIT9:
        r += digits[c - Chars.DIGIT0];
        break;
    }
  }
  // Left pad zeros if minimum integer digits > formatted length
  let diff = minInt - r.length;
  if (diff > 0) {
    let p = '';
    while (diff-- > 0) {