mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
Eslint cleanup (imports left), except template.
This commit is contained in:
10
debounce.js
10
debounce.js
@@ -59,11 +59,11 @@ const nativeMin = Math.min
|
|||||||
*/
|
*/
|
||||||
function debounce(func, wait, options) {
|
function debounce(func, wait, options) {
|
||||||
let lastArgs,
|
let lastArgs,
|
||||||
lastThis,
|
lastThis,
|
||||||
maxWait,
|
maxWait,
|
||||||
result,
|
result,
|
||||||
timerId,
|
timerId,
|
||||||
lastCallTime
|
lastCallTime
|
||||||
|
|
||||||
let lastInvokeTime = 0
|
let lastInvokeTime = 0
|
||||||
let leading = false
|
let leading = false
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const hasOwnProperty = objectProto.hasOwnProperty
|
|||||||
function defaults(object, ...sources) {
|
function defaults(object, ...sources) {
|
||||||
object = Object(object)
|
object = Object(object)
|
||||||
let srcIndex = -1
|
let srcIndex = -1
|
||||||
let srcLength = sources.length
|
const srcLength = sources.length
|
||||||
while (++srcIndex < srcLength) {
|
while (++srcIndex < srcLength) {
|
||||||
const source = sources[srcIndex]
|
const source = sources[srcIndex]
|
||||||
const props = keysIn(source)
|
const props = keysIn(source)
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ function random(lower, upper, floating) {
|
|||||||
}
|
}
|
||||||
if (floating || lower % 1 || upper % 1) {
|
if (floating || lower % 1 || upper % 1) {
|
||||||
const rand = nativeRandom()
|
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))
|
return lower + nativeFloor(nativeRandom() * (upper - lower + 1))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ import toString from './toString.js'
|
|||||||
* replace('Hi Fred', 'Fred', 'Barney')
|
* replace('Hi Fred', 'Fred', 'Barney')
|
||||||
* // => 'Hi Barney'
|
* // => 'Hi Barney'
|
||||||
*/
|
*/
|
||||||
function replace() {
|
function replace(...args) {
|
||||||
const args = arguments
|
|
||||||
const string = toString(args[0])
|
const string = toString(args[0])
|
||||||
|
|
||||||
return args.length < 3 ? string : string.replace(args[1], args[2])
|
return args.length < 3 ? string : string.replace(args[1], args[2])
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ function template(string, options, guard) {
|
|||||||
// Based on John Resig's `tmpl` implementation
|
// Based on John Resig's `tmpl` implementation
|
||||||
// (http://ejohn.org/blog/javascript-micro-templating/)
|
// (http://ejohn.org/blog/javascript-micro-templating/)
|
||||||
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
|
// 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)) {
|
if (guard && isIterateeCall(string, options, guard)) {
|
||||||
options = undefined
|
options = undefined
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
function toPlainObject(value) {
|
function toPlainObject(value) {
|
||||||
value = Object(value)
|
value = Object(value)
|
||||||
const result = {}
|
const result = {}
|
||||||
for (let key in value) {
|
for (const key in value) {
|
||||||
result[key] = value[value]
|
result[key] = value[value]
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user