How to use the cldr.extractTerritoryContainmentGroups function in cldr

To help you get started, we’ve selected a few cldr 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 papandreou / inter / lib / worldInfo.js View on Github external
function extractWorldInfo () {
    // Extract data
    var territoryInfoByTerritoryId = cldr.extractTerritories();
    var territoryContainmentGroups = cldr.extractTerritoryContainmentGroups();

    // Build convenience arrays
    var numericTerritoryIdByAlpha2Code = {};
    Object.keys(territoryInfoByTerritoryId).forEach(function (type) {
        var numericCode = territoryInfoByTerritoryId[type].numericCode;

        if (numericCode) {
            numericTerritoryIdByAlpha2Code[type] = numericCode;
        }
    });

    var containedTerritoriesByAlpha2TerritoryId = {};

    var parentRegionIdByTerritoryId = {};
    var numericRegionIdByTerritoryId = {};
    var alpha2CodeByNumericTerritoryId = {};