code: function findRegionIndex(regionProvider, code, disambigCode) {
    if (!defined(code) || code === "") {
      // Note a code of 0 is ok
      return -1;
    }
    var processedCode = applyReplacements(
      regionProvider,
      code,
      "dataReplacements"
    );
    var id = regionProvider._idIndex[processedCode];
    if (!defined(id)) {
      // didn't find anything
      return -1;
    } else if (typeof id === "number") {
      // found an unambiguous match
      return id;
    } else {
      var ids = id; // found an ambiguous match
      if (!defined(disambigCode)) {
        // we have an ambiguous value, but nothing with which to disambiguate. We pick the first, warn.
        console.warn("Ambiguous value found in region mapping: " + processedCode);
        return ids[0];
      }
      var processedDisambigCode = applyReplacements(
        regionProvider,
        disambigCode,
        "disambigDataReplacements"
      );
  
      // Check out each of the matching IDs to see if the disambiguation field matches the one we have.
      for (var i = 0; i < ids.length; i++) {
        if (
          regionProvider.regions[ids[i]][regionProvider.disambigProp] ===
          processedDisambigCode
        ) {
          return ids[i];
        }
      }
    }
    return -1;
  }
docs: Given a region code, try to find a region that matches it, using replacements, disambiguation, indexes and other wizardry.
  @private
  @param {RegionProvider} regionProvider The RegionProvider instance.
  @param {String} code Code to search for. Falsy codes return -1.
  @returns {Number} Zero-based index in list of regions if successful, or -1.