mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
lint files (#4416)
* lint files * added back arrow-paren and removed duplicate
This commit is contained in:
committed by
John-David Dalton
parent
5b4dc54465
commit
15e1557b2a
@@ -1,6 +1,7 @@
|
|||||||
import baseEach from './baseEach.js'
|
import baseEach from './baseEach.js'
|
||||||
import baseSortBy from './baseSortBy.js'
|
import baseSortBy from './baseSortBy.js'
|
||||||
import compareMultiple from './compareMultiple.js'
|
import compareMultiple from './compareMultiple.js'
|
||||||
|
import isArrayLike from '../isArrayLike.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `orderBy` without param guards.
|
* The base implementation of `orderBy` without param guards.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import isIterateeCall from './isIterateeCall.js';
|
import isIterateeCall from './isIterateeCall.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function like `assign`.
|
* Creates a function like `assign`.
|
||||||
@@ -9,28 +9,28 @@ import isIterateeCall from './isIterateeCall.js';
|
|||||||
*/
|
*/
|
||||||
function createAssigner(assigner) {
|
function createAssigner(assigner) {
|
||||||
return (object, ...sources) => {
|
return (object, ...sources) => {
|
||||||
let index = -1;
|
let index = -1
|
||||||
let length = sources.length;
|
let length = sources.length
|
||||||
let customizer = length > 1 ? sources[length - 1] : undefined;
|
let customizer = length > 1 ? sources[length - 1] : undefined
|
||||||
const guard = length > 2 ? sources[2] : undefined;
|
const guard = length > 2 ? sources[2] : undefined
|
||||||
|
|
||||||
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
||||||
? (length--, customizer)
|
? (length--, customizer)
|
||||||
: undefined;
|
: undefined
|
||||||
|
|
||||||
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
||||||
customizer = length < 3 ? undefined : customizer;
|
customizer = length < 3 ? undefined : customizer
|
||||||
length = 1;
|
length = 1
|
||||||
}
|
}
|
||||||
object = Object(object);
|
object = Object(object)
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
const source = sources[index];
|
const source = sources[index]
|
||||||
if (source) {
|
if (source) {
|
||||||
assigner(object, source, index, customizer);
|
assigner(object, source, index, customizer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return object;
|
return object
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default createAssigner;
|
export default createAssigner
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import isArrayLike from '../isArrayLike.js'
|
import isArrayLike from '../isArrayLike.js'
|
||||||
import isIndex from './isIndex.js'
|
import isIndex from './isIndex.js'
|
||||||
import isObject from '../isObject.js'
|
import isObject from '../isObject.js'
|
||||||
|
import eq from '../eq.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given arguments are from an iteratee call.
|
* Checks if the given arguments are from an iteratee call.
|
||||||
@@ -15,16 +16,16 @@ import isObject from '../isObject.js'
|
|||||||
|
|
||||||
function isIterateeCall(value, index, object) {
|
function isIterateeCall(value, index, object) {
|
||||||
if (!isObject(object)) {
|
if (!isObject(object)) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
const type = typeof index;
|
const type = typeof index
|
||||||
if (type == 'number'
|
if (type == 'number'
|
||||||
? (isArrayLike(object) && isIndex(index, object.length))
|
? (isArrayLike(object) && isIndex(index, object.length))
|
||||||
: (type == 'string' && index in object)
|
: (type == 'string' && index in object)
|
||||||
) {
|
) {
|
||||||
return eq(object[index], value);
|
return eq(object[index], value)
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isIterateeCall
|
export default isIterateeCall
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* global globalThis, self */
|
||||||
import freeGlobal from './freeGlobal.js'
|
import freeGlobal from './freeGlobal.js'
|
||||||
|
|
||||||
/** Detect free variable `globalThis` */
|
/** Detect free variable `globalThis` */
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ function debounce(func, wait, options) {
|
|||||||
|
|
||||||
function startTimer(pendingFunc, wait) {
|
function startTimer(pendingFunc, wait) {
|
||||||
if (useRAF) {
|
if (useRAF) {
|
||||||
root.cancelAnimationFrame(timerId);
|
root.cancelAnimationFrame(timerId)
|
||||||
return root.requestAnimationFrame(pendingFunc)
|
return root.requestAnimationFrame(pendingFunc)
|
||||||
}
|
}
|
||||||
return setTimeout(pendingFunc, wait)
|
return setTimeout(pendingFunc, wait)
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ function findLast (collection, predicate, fromIndex) {
|
|||||||
if (!isArrayLike(collection)) {
|
if (!isArrayLike(collection)) {
|
||||||
collection = Object.keys(collection)
|
collection = Object.keys(collection)
|
||||||
iteratee = predicate
|
iteratee = predicate
|
||||||
predicate = key => iteratee(iterable[key], key, iterable)
|
predicate = (key) => iteratee(iterable[key], key, iterable)
|
||||||
}
|
}
|
||||||
const index = findLastIndex(collection, predicate, fromIndex)
|
const index = findLastIndex(collection, predicate, fromIndex)
|
||||||
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
|
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export default findLast
|
export default findLast
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ function throttle(func, wait, options) {
|
|||||||
return debounce(func, wait, {
|
return debounce(func, wait, {
|
||||||
leading,
|
leading,
|
||||||
trailing,
|
trailing,
|
||||||
'maxWait': wait,
|
'maxWait': wait
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user