dist/utilify.esm.js
function resizeImageByRatio(type, newSize, aspectRatio, decimal) {
        if (!validateHelpers.isNumber(newSize) || !validateHelpers.isNumber(aspectRatio)) {
            newSize = parseFloat(newSize, 10);
            aspectRatio = parseFloat(aspectRatio, 10);
        }

        var dimensions = {};
        decimal = decimal || 4;

        switch (type) {
            case 'width':
                dimensions.width = parseFloat(newSize, 10);
                dimensions.height = parseFloat((newSize / aspectRatio).toFixed(decimal), 10);

                break;

            case 'height':
                dimensions.width = parseFloat((newSize * aspectRatio).toFixed(decimal), 10);
                dimensions.height = parseFloat(newSize, 10);

                break;

            default:
                throw new Error('\'type\' needs to be \'width\' or \'height\'');
        }

        return dimensions;
    }
function resizeImageByRatio(type, newSize, aspectRatio, decimal) {
        if (!validateHelpers.isNumber(newSize) || !validateHelpers.isNumber(aspectRatio)) {
            newSize = parseFloat(newSize, 10);
            aspectRatio = parseFloat(aspectRatio, 10);
        }

        var dimensions = {};
        decimal = decimal || 4;

        switch (type) {
            case 'width':
                dimensions.width = parseFloat(newSize, 10);
                dimensions.height = parseFloat((newSize / aspectRatio).toFixed(decimal), 10);

                break;

            case 'height':
                dimensions.width = parseFloat((newSize * aspectRatio).toFixed(decimal), 10);
                dimensions.height = parseFloat(newSize, 10);

                break;

            default:
                throw new Error('\'type\' needs to be \'width\' or \'height\'');
        }

        return dimensions;
    }
function resizeImageByRatio ( type , newSize , aspectRatio , decimal ) { if ( ! validateHelpers . isNumber ( newSize ) || ! validateHelpers . isNumber ( aspectRatio ) ) { newSize = parseFloat ( newSize , 10 ) ; aspectRatio = parseFloat ( aspectRatio , 10 ) ; } var dimensions = { } ; decimal = decimal || 4 ; switch ( type ) { case 'width' : dimensions . width = parseFloat ( newSize , 10 ) ; dimensions . height = parseFloat ( ( newSize / aspectRatio ) . toFixed ( decimal ) , 10 ) ; break ; case 'height' : dimensions . width = parseFloat ( ( newSize * aspectRatio ) . toFixed ( decimal ) , 10 ) ; dimensions . height = parseFloat ( newSize , 10 ) ; break ; default : throw new Error ( '\'type\' needs to be \'width\' or \'height\'' ) ; } return dimensions ; }
Resize image by aspect ratio

@category Global
@param  {String} type          Resize by 'width' or 'height'
@param  {Number} newSize       New value to resize
@param  {Number} aspectRatio   Image aspect ratio (calculate by (width / height))
@return {Object}               Object with new 'width' and 'height'
Resize image by aspect ratio