Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / baseFilter.js
1 var baseEach = require('./baseEach');
2
3 /**
4  * The base implementation of `_.filter` without support for callback
5  * shorthands and `this` binding.
6  *
7  * @private
8  * @param {Array|Object|string} collection The collection to iterate over.
9  * @param {Function} predicate The function invoked per iteration.
10  * @returns {Array} Returns the new filtered array.
11  */
12 function baseFilter(collection, predicate) {
13   var result = [];
14   baseEach(collection, function(value, index, collection) {
15     if (predicate(value, index, collection)) {
16       result.push(value);
17     }
18   });
19   return result;
20 }
21
22 module.exports = baseFilter;