index.js 981 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*!
  2. * assign-symbols <https://github.com/jonschlinkert/assign-symbols>
  3. *
  4. * Copyright (c) 2015, Jon Schlinkert.
  5. * Licensed under the MIT License.
  6. */
  7. 'use strict';
  8. module.exports = function(receiver, objects) {
  9. if (receiver === null || typeof receiver === 'undefined') {
  10. throw new TypeError('expected first argument to be an object.');
  11. }
  12. if (typeof objects === 'undefined' || typeof Symbol === 'undefined') {
  13. return receiver;
  14. }
  15. if (typeof Object.getOwnPropertySymbols !== 'function') {
  16. return receiver;
  17. }
  18. var isEnumerable = Object.prototype.propertyIsEnumerable;
  19. var target = Object(receiver);
  20. var len = arguments.length, i = 0;
  21. while (++i < len) {
  22. var provider = Object(arguments[i]);
  23. var names = Object.getOwnPropertySymbols(provider);
  24. for (var j = 0; j < names.length; j++) {
  25. var key = names[j];
  26. if (isEnumerable.call(provider, key)) {
  27. target[key] = provider[key];
  28. }
  29. }
  30. }
  31. return target;
  32. };