code: function getPluralFunction(locale) {
    let fn = cldr.extractPluralRuleFunction(locale).toString();
  
    if (fn === EMPTY_RULE) {
      fn = DEFAULT_RULE;
    }
  
    fn = fn
      .replace(
        toRegExp('function anonymous(n\n/*``*/) {\n'),
        'function plural(n: number): number {\n  ')
      .replace(toRegExp('var'), 'let')
      .replace(toRegExp('if(typeof n==="string")n=parseInt(n,10);'), '')
      .replace(toRegExp('\n}'), ';\n}');
  
    // The replacement values must match the `Plural` enum from common.
    // We do not use the enum directly to avoid depending on that package.
    return fn
      .replace(toRegExp('"zero"'), ' 0')
      .replace(toRegExp('"one"'), ' 1')
      .replace(toRegExp('"two"'), ' 2')
      .replace(toRegExp('"few"'), ' 3')
      .replace(toRegExp('"many"'), ' 4')
      .replace(toRegExp('"other"'), ' 5');
  }
docs: Returns the plural function for a locale
  todo(ocombe): replace "cldr" extractPluralRuleFunction with our own extraction using "CldrJS"
  because the 2 libs can become out of sync if they use different versions of the cldr database