odoo-13.0/addons/web/static/src/js/fields/field_utils.js
/**
 * Parse a String containing a percentage and convert it to float.
 * The percentage can be a regular xx.xx float or a xx%.
 *
 * @param {string} value
 *                The string to be parsed
 * @returns {float}
 * @throws {Error} if the value couldn't be converted to float
 */
Parse a String containing a percentage and convert it to float.
The percentage can be a regular xx.xx float or a xx%.

@param {string} value
The string to be parsed
@returns {float}
@throws {Error} if the value couldn't be converted to float
Parse a String containing a percentage and convert it to float . The percentage can be a regular xx . xx float or a xx% . @param { string } value The string to be parsed @returns { float } @throws { Error } if the value couldn ' t be converted to float
function parsePercentage(value) {
    if (value.slice(-1) === '%') {
        return parseFloat(value.slice(0, -1)) / 100;
    }
    return parseFloat(value);
}
function parsePercentage ( value ) { if ( value . slice ( - 1 ) === '%' ) { return parseFloat ( value . slice ( 0 , - 1 ) ) / 100 ; } return parseFloat ( value ) ; }
Parse a String containing a percentage and convert it to float.
Parse a String containing a percentage and convert it to float .