source/source-jquery.crs.js
function (countries, preferred, preferredDelim) {
        var preferredShortCodes = preferred.split(',').reverse();
        var preferredMap = {};
        var foundPreferred = false;

        var updatedCountries = countries.filter(function (c) {
            if (preferredShortCodes.indexOf(c[1]) !== -1) {
                preferredMap[c[1]] = c;
                foundPreferred = true;
                return false;
            }
            return true;
        });

        if (foundPreferred && preferredDelim) {
            updatedCountries.unshift([preferredDelim, "", "", {}, true]);
        }

        // now prepend the preferred countries
        for (var i=0; i<preferredShortCodes.length; i++) {
            var code = preferredShortCodes[i];
            updatedCountries.unshift(preferredMap[code]);
        }

        return updatedCountries;
    }
function (countries, preferred, preferredDelim) {
        var preferredShortCodes = preferred.split(',').reverse();
        var preferredMap = {};
        var foundPreferred = false;

        var updatedCountries = countries.filter(function (c) {
            if (preferredShortCodes.indexOf(c[1]) !== -1) {
                preferredMap[c[1]] = c;
                foundPreferred = true;
                return false;
            }
            return true;
        });

        if (foundPreferred && preferredDelim) {
            updatedCountries.unshift([preferredDelim, "", "", {}, true]);
        }

        // now prepend the preferred countries
        for (var i=0; i<preferredShortCodes.length; i++) {
            var code = preferredShortCodes[i];
            updatedCountries.unshift(preferredMap[code]);
        }

        return updatedCountries;
    }
function ( countries , preferred , preferredDelim ) { var preferredShortCodes = preferred . split ( ',' ) . reverse ( ) ; var preferredMap = { } ; var foundPreferred = false ; var updatedCountries = countries . filter ( function ( c ) { if ( preferredShortCodes . indexOf ( c [ 1 ] ) !== - 1 ) { preferredMap [ c [ 1 ] ] = c ; foundPreferred = true ; return false ; } return true ; } ) ; if ( foundPreferred && preferredDelim ) { updatedCountries . unshift ( [ preferredDelim , "" , "" , { } , true ] ) ; } // now prepend the preferred countries for ( var i = 0 ; i < preferredShortCodes . length ; i ++ ) { var code = preferredShortCodes [ i ] ; updatedCountries . unshift ( preferredMap [ code ] ) ; } return updatedCountries ; }
in 0.5.0 we added the option for "preferred" countries that get listed first. This just causes the preferred countries to get listed at the top of the list with an optional delimiter row following them
in 0 . 5 . 0 we added the option for preferred countries that get listed first . This just causes the preferred countries to get listed at the top of the list with an optional delimiter row following them