a zip code crypto-currency system good for red ONLY

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. 'use strict';
  2. var isExtendable = require('is-extendable');
  3. var forIn = require('for-in');
  4. function mixinDeep(target, objects) {
  5. var len = arguments.length, i = 0;
  6. while (++i < len) {
  7. var obj = arguments[i];
  8. if (isObject(obj)) {
  9. forIn(obj, copy, target);
  10. }
  11. }
  12. return target;
  13. }
  14. /**
  15. * Copy properties from the source object to the
  16. * target object.
  17. *
  18. * @param {*} `val`
  19. * @param {String} `key`
  20. */
  21. function copy(val, key) {
  22. if (key === '__proto__') {
  23. return;
  24. }
  25. var obj = this[key];
  26. if (isObject(val) && isObject(obj)) {
  27. mixinDeep(obj, val);
  28. } else {
  29. this[key] = val;
  30. }
  31. }
  32. /**
  33. * Returns true if `val` is an object or function.
  34. *
  35. * @param {any} val
  36. * @return {Boolean}
  37. */
  38. function isObject(val) {
  39. return isExtendable(val) && !Array.isArray(val);
  40. }
  41. /**
  42. * Expose `mixinDeep`
  43. */
  44. module.exports = mixinDeep;