lib/client.js
function(imageIdentifier, usePrimary) {
        if (usePrimary) {
            return this.options.hosts[0];
        }

        var dec = imageIdentifier.charCodeAt(imageIdentifier.length - 1);

        // If this is an old image identifier (32 character hex string),
        // maintain backwards compatibility
        if (imageIdentifier.match(/^[a-f0-9]{32}$/)) {
            dec = parseInt(imageIdentifier.substr(0, 2), 16);
        }

        return this.options.hosts[dec % this.options.hosts.length];
    }
function(imageIdentifier, usePrimary) {
        if (usePrimary) {
            return this.options.hosts[0];
        }

        var dec = imageIdentifier.charCodeAt(imageIdentifier.length - 1);

        // If this is an old image identifier (32 character hex string),
        // maintain backwards compatibility
        if (imageIdentifier.match(/^[a-f0-9]{32}$/)) {
            dec = parseInt(imageIdentifier.substr(0, 2), 16);
        }

        return this.options.hosts[dec % this.options.hosts.length];
    }
function ( imageIdentifier , usePrimary ) { if ( usePrimary ) { return this . options . hosts [ 0 ] ; } var dec = imageIdentifier . charCodeAt ( imageIdentifier . length - 1 ) ; // If this is an old image identifier (32 character hex string), // maintain backwards compatibility if ( imageIdentifier . match ( / ^[a-f0-9]{32}$ / ) ) { dec = parseInt ( imageIdentifier . substr ( 0 , 2 ) , 16 ) ; } return this . options . hosts [ dec % this . options . hosts . length ] ; }
Get a predictable hostname for the given image identifier

@param  {String} imageIdentifier
@param  {Boolean} [usePrimary=false] Whether to use the primary host
@return {String}
Get a predictable hostname for the given image identifier