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.

assignIn.js 906B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. var copyObject = require('./_copyObject'),
  2. createAssigner = require('./_createAssigner'),
  3. keysIn = require('./keysIn');
  4. /**
  5. * This method is like `_.assign` except that it iterates over own and
  6. * inherited source properties.
  7. *
  8. * **Note:** This method mutates `object`.
  9. *
  10. * @static
  11. * @memberOf _
  12. * @since 4.0.0
  13. * @alias extend
  14. * @category Object
  15. * @param {Object} object The destination object.
  16. * @param {...Object} [sources] The source objects.
  17. * @returns {Object} Returns `object`.
  18. * @see _.assign
  19. * @example
  20. *
  21. * function Foo() {
  22. * this.a = 1;
  23. * }
  24. *
  25. * function Bar() {
  26. * this.c = 3;
  27. * }
  28. *
  29. * Foo.prototype.b = 2;
  30. * Bar.prototype.d = 4;
  31. *
  32. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  33. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  34. */
  35. var assignIn = createAssigner(function(object, source) {
  36. copyObject(source, keysIn(source), object);
  37. });
  38. module.exports = assignIn;