pogobuf/pogobuf.utils.js
function(pokemon, decimals) {
        if (typeof decimals === 'undefined') decimals = -1;

        decimals = Math.min(decimals, 20);

        var att = pokemon.individual_attack,
            def = pokemon.individual_defense,
            stam = pokemon.individual_stamina;

        var unroundedPercentage = (att + def + stam) / 45 * 100;
        var percent = decimals < 0 ? unroundedPercentage : +unroundedPercentage.toFixed(decimals);

        return {
            att: att,
            def: def,
            stam: stam,
            percent: percent
        };
    }
function(pokemon, decimals) {
        if (typeof decimals === 'undefined') decimals = -1;

        decimals = Math.min(decimals, 20);

        var att = pokemon.individual_attack,
            def = pokemon.individual_defense,
            stam = pokemon.individual_stamina;

        var unroundedPercentage = (att + def + stam) / 45 * 100;
        var percent = decimals < 0 ? unroundedPercentage : +unroundedPercentage.toFixed(decimals);

        return {
            att: att,
            def: def,
            stam: stam,
            percent: percent
        };
    }
Utility method to get the Individual Values from Pokémon
@param {object} pokemon - A pokemon_data structure
@param {integer} [decimals=-1] - Amount of decimals, negative values do not round, max 20
@returns {object}
@static