mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 09:27:49 +00:00
Remove baseIteratee and castFunction.
This commit is contained in:
17
reject.js
17
reject.js
@@ -1,6 +1,5 @@
|
||||
import arrayFilter from './_arrayFilter.js';
|
||||
import baseFilter from './_baseFilter.js';
|
||||
import baseIteratee from './_baseIteratee.js';
|
||||
import isArray from './isArray.js';
|
||||
import negate from './negate.js';
|
||||
|
||||
@@ -13,7 +12,7 @@ import negate from './negate.js';
|
||||
* @since 0.1.0
|
||||
* @category Collection
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {Array} Returns the new filtered array.
|
||||
* @see _.filter
|
||||
* @example
|
||||
@@ -25,22 +24,10 @@ import negate from './negate.js';
|
||||
*
|
||||
* _.reject(users, function(o) { return !o.active; });
|
||||
* // => objects for ['fred']
|
||||
*
|
||||
* // The `_.matches` iteratee shorthand.
|
||||
* _.reject(users, { 'age': 40, 'active': true });
|
||||
* // => objects for ['barney']
|
||||
*
|
||||
* // The `_.matchesProperty` iteratee shorthand.
|
||||
* _.reject(users, ['active', false]);
|
||||
* // => objects for ['fred']
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.reject(users, 'active');
|
||||
* // => objects for ['barney']
|
||||
*/
|
||||
function reject(collection, predicate) {
|
||||
const func = isArray(collection) ? arrayFilter : baseFilter;
|
||||
return func(collection, negate(baseIteratee(predicate, 3)));
|
||||
return func(collection, negate(predicate));
|
||||
}
|
||||
|
||||
export default reject;
|
||||
|
||||
Reference in New Issue
Block a user