Sha256: 25fc3ecc0c2e6541e69c3ee17208b9660b5a425d974050230a544d480cfe8d1a

Contents?: true

Size: 620 Bytes

Versions: 153

Compression:

Stored size: 620 Bytes

Contents

/** Native method references. */
var pow = Math.pow;

/**
 * Creates a `_.ceil`, `_.floor`, or `_.round` function.
 *
 * @private
 * @param {string} methodName The name of the `Math` method to use when rounding.
 * @returns {Function} Returns the new round function.
 */
function createRound(methodName) {
  var func = Math[methodName];
  return function(number, precision) {
    precision = precision === undefined ? 0 : (+precision || 0);
    if (precision) {
      precision = pow(10, precision);
      return func(number * precision) / precision;
    }
    return func(number);
  };
}

module.exports = createRound;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/internal/createRound.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/createRound.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/internal/createRound.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/internal/createRound.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/internal/createRound.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/createRound.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/internal/createRound.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/internal/createRound.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/createRound.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createRound.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createRound.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createRound.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createRound.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createRound.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createRound.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/internal/createRound.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createRound.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createRound.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createRound.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/createRound.js