Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_baseFilter.js 590B

123456789101112131415161718192021
  1. var baseEach = require('./_baseEach');
  2. /**
  3. * The base implementation of `_.filter` without support for iteratee shorthands.
  4. *
  5. * @private
  6. * @param {Array|Object} collection The collection to iterate over.
  7. * @param {Function} predicate The function invoked per iteration.
  8. * @returns {Array} Returns the new filtered array.
  9. */
  10. function baseFilter(collection, predicate) {
  11. var result = [];
  12. baseEach(collection, function(value, index, collection) {
  13. if (predicate(value, index, collection)) {
  14. result.push(value);
  15. }
  16. });
  17. return result;
  18. }
  19. module.exports = baseFilter;