mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Remove isFunction use.
This commit is contained in:
@@ -6,7 +6,6 @@ import initCloneObject from './initCloneObject.js'
|
|||||||
import isArguments from '../isArguments.js'
|
import isArguments from '../isArguments.js'
|
||||||
import isArrayLikeObject from '../isArrayLikeObject.js'
|
import isArrayLikeObject from '../isArrayLikeObject.js'
|
||||||
import isBuffer from '../isBuffer.js'
|
import isBuffer from '../isBuffer.js'
|
||||||
import isFunction from '../isFunction.js'
|
|
||||||
import isObject from '../isObject.js'
|
import isObject from '../isObject.js'
|
||||||
import isPlainObject from '../isPlainObject.js'
|
import isPlainObject from '../isPlainObject.js'
|
||||||
import isTypedArray from '../isTypedArray.js'
|
import isTypedArray from '../isTypedArray.js'
|
||||||
@@ -72,7 +71,7 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta
|
|||||||
if (isArguments(objValue)) {
|
if (isArguments(objValue)) {
|
||||||
newValue = toPlainObject(objValue)
|
newValue = toPlainObject(objValue)
|
||||||
}
|
}
|
||||||
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
|
else if ((srcIndex && typeof objValue == 'function') || !isObject(objValue)) {
|
||||||
newValue = initCloneObject(srcValue)
|
newValue = initCloneObject(srcValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import isFunction from './isFunction.js'
|
|
||||||
import isLength from './isLength.js'
|
import isLength from './isLength.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,7 +24,7 @@ import isLength from './isLength.js'
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isArrayLike(value) {
|
function isArrayLike(value) {
|
||||||
return value != null && isLength(value.length) && !isFunction(value)
|
return value != null && typeof value != 'function' && isLength(value.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isArrayLike
|
export default isArrayLike
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import castPath from './.internal/castPath.js'
|
import castPath from './.internal/castPath.js'
|
||||||
import isFunction from './isFunction.js'
|
|
||||||
import toKey from './.internal/toKey.js'
|
import toKey from './.internal/toKey.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +45,7 @@ function result(object, path, defaultValue) {
|
|||||||
index = length
|
index = length
|
||||||
value = defaultValue
|
value = defaultValue
|
||||||
}
|
}
|
||||||
object = isFunction(value) ? value.call(object) : value
|
object = typeof value == 'function' ? value.call(object) : value
|
||||||
}
|
}
|
||||||
return object
|
return object
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import arrayEach from './.internal/arrayEach.js'
|
import arrayEach from './.internal/arrayEach.js'
|
||||||
import baseForOwn from './.internal/baseForOwn.js'
|
import baseForOwn from './.internal/baseForOwn.js'
|
||||||
import isBuffer from './isBuffer.js'
|
import isBuffer from './isBuffer.js'
|
||||||
import isFunction from './isFunction.js'
|
|
||||||
import isObject from './isObject.js'
|
import isObject from './isObject.js'
|
||||||
import isTypedArray from './isTypedArray.js'
|
import isTypedArray from './isTypedArray.js'
|
||||||
|
|
||||||
@@ -44,7 +43,9 @@ function transform(object, iteratee, accumulator) {
|
|||||||
accumulator = isArr ? new Ctor : []
|
accumulator = isArr ? new Ctor : []
|
||||||
}
|
}
|
||||||
else if (isObject(object)) {
|
else if (isObject(object)) {
|
||||||
accumulator = isFunction(Ctor) ? Object.create(Object.getPrototypeOf(object)) : {}
|
accumulator = typeof Ctor == 'function'
|
||||||
|
? Object.create(Object.getPrototypeOf(object))
|
||||||
|
: {}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
accumulator = {}
|
accumulator = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user