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.

pick.js 629B

12345678910111213141516171819202122232425
  1. var basePick = require('./_basePick'),
  2. flatRest = require('./_flatRest');
  3. /**
  4. * Creates an object composed of the picked `object` properties.
  5. *
  6. * @static
  7. * @since 0.1.0
  8. * @memberOf _
  9. * @category Object
  10. * @param {Object} object The source object.
  11. * @param {...(string|string[])} [paths] The property paths to pick.
  12. * @returns {Object} Returns the new object.
  13. * @example
  14. *
  15. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  16. *
  17. * _.pick(object, ['a', 'c']);
  18. * // => { 'a': 1, 'c': 3 }
  19. */
  20. var pick = flatRest(function(object, paths) {
  21. return object == null ? {} : basePick(object, paths);
  22. });
  23. module.exports = pick;