Apply more let/const transforms.

This commit is contained in:
John-David Dalton
2017-01-08 23:38:19 -08:00
parent ca9e6fa087
commit 4d0c15b49e
115 changed files with 621 additions and 613 deletions

View File

@@ -3,7 +3,7 @@ import toNumber from './toNumber.js';
import toString from './toString.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
const nativeMin = Math.min;
/**
* Creates a function like `_.round`.
@@ -13,15 +13,15 @@ var nativeMin = Math.min;
* @returns {Function} Returns the new round function.
*/
function createRound(methodName) {
var func = Math[methodName];
const func = Math[methodName];
return (number, precision) => {
number = toNumber(number);
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
if (precision) {
// Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details.
var pair = `${ toString(number) }e`.split('e'),
value = func(`${ pair[0] }e${ +pair[1] + precision }`);
let pair = `${ toString(number) }e`.split('e');
const value = func(`${ pair[0] }e${ +pair[1] + precision }`);
pair = `${ toString(value) }e`.split('e');
return +`${ pair[0] }e${ +pair[1] - precision }`;