How to use the @phensley/cldr-ext-rbnf/lib/rbnftypes.RuleType.NORMAL_RADIX function in @phensley/cldr-ext-rbnf

To help you get started, we’ve selected a few @phensley/cldr-ext-rbnf 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-compiler / src / rbnf / encoder.ts View on Github external
// Decode the rule descriptor.
        const { value } = raw;

        if (/^\d+$/.test(value)) {
          // Normal rule without an explicit radix.
          const i = numbers.indexOf(value);
          rules.push([RuleType.NORMAL, inst, i]);

        } else if (/^\d+(\/\d+)?$/.test(value)) {
          // Normal rule with explicit radix
          const p = value.split('/');
          const i = numbers.indexOf(p[0]);
          const j = numbers.indexOf(p[1]);

          rules.push([RuleType.NORMAL_RADIX, inst, i, j]);

        } else {
          // Atom rule
          switch (value) {
            case '-x':
              rules.push([RuleType.MINUS, inst]);
              break;

            case '0.x':
              rules.push([RuleType.PROPER_FRACTION, inst, 0]);
              if (!comma) {
                rules.push([RuleType.PROPER_FRACTION, inst, 1]);
              }
              break;

            case '0,x':