From ffcb38f74d6efab412d7dbad5d016366d18c2017 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 24 Feb 2017 23:34:08 -0800 Subject: [PATCH] Remove `isFunction` use. --- .internal/baseMergeDeep.js | 3 +-- isArrayLike.js | 3 +-- result.js | 3 +-- transform.js | 5 +++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.internal/baseMergeDeep.js b/.internal/baseMergeDeep.js index e6fee0475..23a289bbd 100644 --- a/.internal/baseMergeDeep.js +++ b/.internal/baseMergeDeep.js @@ -6,7 +6,6 @@ import initCloneObject from './initCloneObject.js' import isArguments from '../isArguments.js' import isArrayLikeObject from '../isArrayLikeObject.js' import isBuffer from '../isBuffer.js' -import isFunction from '../isFunction.js' import isObject from '../isObject.js' import isPlainObject from '../isPlainObject.js' import isTypedArray from '../isTypedArray.js' @@ -72,7 +71,7 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta if (isArguments(objValue)) { newValue = toPlainObject(objValue) } - else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { + else if ((srcIndex && typeof objValue == 'function') || !isObject(objValue)) { newValue = initCloneObject(srcValue) } } diff --git a/isArrayLike.js b/isArrayLike.js index ff8e1823c..73f8b633c 100644 --- a/isArrayLike.js +++ b/isArrayLike.js @@ -1,4 +1,3 @@ -import isFunction from './isFunction.js' import isLength from './isLength.js' /** @@ -25,7 +24,7 @@ import isLength from './isLength.js' * // => false */ function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value) + return value != null && typeof value != 'function' && isLength(value.length) } export default isArrayLike diff --git a/result.js b/result.js index 0f5c2ee6c..84e42a86f 100644 --- a/result.js +++ b/result.js @@ -1,5 +1,4 @@ import castPath from './.internal/castPath.js' -import isFunction from './isFunction.js' import toKey from './.internal/toKey.js' /** @@ -46,7 +45,7 @@ function result(object, path, defaultValue) { index = length value = defaultValue } - object = isFunction(value) ? value.call(object) : value + object = typeof value == 'function' ? value.call(object) : value } return object } diff --git a/transform.js b/transform.js index 12534e5c3..db279dbc6 100644 --- a/transform.js +++ b/transform.js @@ -1,7 +1,6 @@ import arrayEach from './.internal/arrayEach.js' import baseForOwn from './.internal/baseForOwn.js' import isBuffer from './isBuffer.js' -import isFunction from './isFunction.js' import isObject from './isObject.js' import isTypedArray from './isTypedArray.js' @@ -44,7 +43,9 @@ function transform(object, iteratee, accumulator) { accumulator = isArr ? new Ctor : [] } else if (isObject(object)) { - accumulator = isFunction(Ctor) ? Object.create(Object.getPrototypeOf(object)) : {} + accumulator = typeof Ctor == 'function' + ? Object.create(Object.getPrototypeOf(object)) + : {} } else { accumulator = {}