From 16413cc32ad5d2e739cb02e5bf89872069b09830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipi=C5=84ski?= Date: Fri, 17 Feb 2017 23:22:07 +0100 Subject: [PATCH] Eslint cleanup (imports left), except template. --- debounce.js | 10 +++++----- defaults.js | 2 +- random.js | 3 ++- replace.js | 3 +-- template.js | 2 +- toPlainObject.js | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/debounce.js b/debounce.js index 9cf01fdd31..6d543b1c5c 100644 --- a/debounce.js +++ b/debounce.js @@ -59,11 +59,11 @@ const nativeMin = Math.min */ function debounce(func, wait, options) { let lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime + lastThis, + maxWait, + result, + timerId, + lastCallTime let lastInvokeTime = 0 let leading = false diff --git a/defaults.js b/defaults.js index 16e2af0262..01e44e3ee4 100644 --- a/defaults.js +++ b/defaults.js @@ -29,7 +29,7 @@ const hasOwnProperty = objectProto.hasOwnProperty function defaults(object, ...sources) { object = Object(object) let srcIndex = -1 - let srcLength = sources.length + const srcLength = sources.length while (++srcIndex < srcLength) { const source = sources[srcIndex] const props = keysIn(source) diff --git a/random.js b/random.js index d9ea6037fd..8ebaa701f3 100644 --- a/random.js +++ b/random.js @@ -73,7 +73,8 @@ function random(lower, upper, floating) { } if (floating || lower % 1 || upper % 1) { const rand = nativeRandom() - return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper) + const randLength = `${ rand }`.length - 1 + return nativeMin(lower + (rand * (upper - lower + freeParseFloat(`1e-${ randLength }`)), upper)) } return lower + nativeFloor(nativeRandom() * (upper - lower + 1)) } diff --git a/replace.js b/replace.js index f87b713dee..d41b23e683 100644 --- a/replace.js +++ b/replace.js @@ -18,8 +18,7 @@ import toString from './toString.js' * replace('Hi Fred', 'Fred', 'Barney') * // => 'Hi Barney' */ -function replace() { - const args = arguments +function replace(...args) { const string = toString(args[0]) return args.length < 3 ? string : string.replace(args[1], args[2]) diff --git a/template.js b/template.js index 75aac6a1a5..ccb8596ddc 100644 --- a/template.js +++ b/template.js @@ -142,7 +142,7 @@ function template(string, options, guard) { // Based on John Resig's `tmpl` implementation // (http://ejohn.org/blog/javascript-micro-templating/) // and Laura Doktorova's doT.js (https://github.com/olado/doT). - let settings = templateSettings.imports.templateSettings || templateSettings + const settings = templateSettings.imports.templateSettings || templateSettings if (guard && isIterateeCall(string, options, guard)) { options = undefined diff --git a/toPlainObject.js b/toPlainObject.js index f8242e4816..5b62d47446 100644 --- a/toPlainObject.js +++ b/toPlainObject.js @@ -23,7 +23,7 @@ function toPlainObject(value) { value = Object(value) const result = {} - for (let key in value) { + for (const key in value) { result[key] = value[value] } return result