lib/format.js
function UDecimalPad(num, precision) {
    var value = UDecimalString(num);
    assert.equal("number", typeof precision === 'undefined' ? 'undefined' : (0, _typeof3.default)(precision), "precision");

    var part = value.split(".");

    if (precision === 0 && part.length === 1) {
        return part[0];
    }

    if (part.length === 1) {
        return part[0] + '.' + "0".repeat(precision);
    } else {
        var pad = precision - part[1].length;
        assert(pad >= 0, 'decimal \'' + value + '\' exceeds precision ' + precision);
        return part[0] + '.' + part[1] + "0".repeat(pad);
    }
}
function UDecimalPad(num, precision) {
    var value = UDecimalString(num);
    assert.equal("number", typeof precision === 'undefined' ? 'undefined' : (0, _typeof3.default)(precision), "precision");

    var part = value.split(".");

    if (precision === 0 && part.length === 1) {
        return part[0];
    }

    if (part.length === 1) {
        return part[0] + '.' + "0".repeat(precision);
    } else {
        var pad = precision - part[1].length;
        assert(pad >= 0, 'decimal \'' + value + '\' exceeds precision ' + precision);
        return part[0] + '.' + part[1] + "0".repeat(pad);
    }
}
Ensure a fixed number of decimal places.  Safe for large numbers.

@see ./format.test.js

@example UDecimalPad(10.2, 3) === '10.200'

@arg {number|string|object.toString} value
@arg {number} precision - number of decimal places
@return {string} decimal part is added and zero padded to match precision