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.

_basePickBy.js 791B

123456789101112131415161718192021222324252627282930
  1. var baseGet = require('./_baseGet'),
  2. baseSet = require('./_baseSet'),
  3. castPath = require('./_castPath');
  4. /**
  5. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  6. *
  7. * @private
  8. * @param {Object} object The source object.
  9. * @param {string[]} paths The property paths to pick.
  10. * @param {Function} predicate The function invoked per property.
  11. * @returns {Object} Returns the new object.
  12. */
  13. function basePickBy(object, paths, predicate) {
  14. var index = -1,
  15. length = paths.length,
  16. result = {};
  17. while (++index < length) {
  18. var path = paths[index],
  19. value = baseGet(object, path);
  20. if (predicate(value, path)) {
  21. baseSet(result, castPath(path, object), value);
  22. }
  23. }
  24. return result;
  25. }
  26. module.exports = basePickBy;