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.

23 lines
381 B

7 years ago
  1. /**
  2. * Merge object b with object a.
  3. *
  4. * var a = { foo: 'bar' }
  5. * , b = { bar: 'baz' };
  6. *
  7. * merge(a, b);
  8. * // => { foo: 'bar', bar: 'baz' }
  9. *
  10. * @param {Object} a
  11. * @param {Object} b
  12. * @return {Object}
  13. * @api public
  14. */
  15. exports = module.exports = function(a, b){
  16. if (a && b) {
  17. for (var key in b) {
  18. a[key] = b[key];
  19. }
  20. }
  21. return a;
  22. };