mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Use native filter instead of custom one where possible (#4116)
This commit is contained in:
committed by
John-David Dalton
parent
aa1d7d870d
commit
238e763aa1
@@ -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
|
||||
|
||||
3
xor.js
3
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
|
||||
|
||||
3
xorBy.js
3
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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user