1 /** Native method references. */
5 * Creates a `_.ceil`, `_.floor`, or `_.round` function.
8 * @param {string} methodName The name of the `Math` method to use when rounding.
9 * @returns {Function} Returns the new round function.
11 function createRound(methodName) {
12 var func = Math[methodName];
13 return function(number, precision) {
14 precision = precision === undefined ? 0 : (+precision || 0);
16 precision = pow(10, precision);
17 return func(number * precision) / precision;
23 module.exports = createRound;