From 238e763aa1973c53a6222989d8fc45bb8502b688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Am=C3=A9rico?= Date: Tue, 11 Dec 2018 13:26:35 -0300 Subject: [PATCH] Use native filter instead of custom one where possible (#4116) --- .internal/getSymbols.js | 4 +--- xor.js | 3 +-- xorBy.js | 3 +-- xorWith.js | 3 +-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.internal/getSymbols.js b/.internal/getSymbols.js index a89d7497b..a3f59bbf6 100644 --- a/.internal/getSymbols.js +++ b/.internal/getSymbols.js @@ -1,5 +1,3 @@ -import filter from '../filter.js' - /** Built-in value references. */ const propertyIsEnumerable = Object.prototype.propertyIsEnumerable @@ -18,7 +16,7 @@ function getSymbols (object) { return [] } object = Object(object) - return filter(nativeGetSymbols(object), (symbol) => propertyIsEnumerable.call(object, symbol)) + return nativeGetSymbols(object).filter((symbol) => propertyIsEnumerable.call(object, symbol)) } export default getSymbols diff --git a/xor.js b/xor.js index db45881d2..8b5e8688e 100644 --- a/xor.js +++ b/xor.js @@ -1,4 +1,3 @@ -import filter from './filter.js' import baseXor from './.internal/baseXor.js' import isArrayLikeObject from './isArrayLikeObject.js' @@ -19,7 +18,7 @@ import isArrayLikeObject from './isArrayLikeObject.js' * // => [1, 3] */ function xor(...arrays) { - return baseXor(filter(arrays, isArrayLikeObject)) + return baseXor(arrays.filter(isArrayLikeObject)) } export default xor diff --git a/xorBy.js b/xorBy.js index 6064b016a..87b75a355 100644 --- a/xorBy.js +++ b/xorBy.js @@ -1,4 +1,3 @@ -import filter from './filter.js' import baseXor from './.internal/baseXor.js' import isArrayLikeObject from './isArrayLikeObject.js' import last from './last.js' @@ -26,7 +25,7 @@ function xorBy(...arrays) { if (isArrayLikeObject(iteratee)) { iteratee = undefined } - return baseXor(filter(arrays, isArrayLikeObject), iteratee) + return baseXor(arrays.filter(isArrayLikeObject), iteratee) } export default xorBy diff --git a/xorWith.js b/xorWith.js index 802d376d7..e53b67052 100644 --- a/xorWith.js +++ b/xorWith.js @@ -1,4 +1,3 @@ -import filter from './filter.js' import baseXor from './.internal/baseXor.js' import isArrayLikeObject from './isArrayLikeObject.js' import last from './last.js' @@ -26,7 +25,7 @@ import last from './last.js' function xorWith(...arrays) { let comparator = last(arrays) comparator = typeof comparator == 'function' ? comparator : undefined - return baseXor(filter(arrays, isArrayLikeObject), undefined, comparator) + return baseXor(arrays.filter(isArrayLikeObject), undefined, comparator) } export default xorWith