object-assign-auto.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. 'use strict';
  3. require('./index').polyfill();
  4. },{"./index":2}],2:[function(require,module,exports){
  5. /**
  6. * Code refactored from Mozilla Developer Network:
  7. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
  8. */
  9. 'use strict';
  10. function assign(target, firstSource) {
  11. if (target === undefined || target === null) {
  12. throw new TypeError('Cannot convert first argument to object');
  13. }
  14. var to = Object(target);
  15. for (var i = 1; i < arguments.length; i++) {
  16. var nextSource = arguments[i];
  17. if (nextSource === undefined || nextSource === null) {
  18. continue;
  19. }
  20. var keysArray = Object.keys(Object(nextSource));
  21. for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
  22. var nextKey = keysArray[nextIndex];
  23. var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
  24. if (desc !== undefined && desc.enumerable) {
  25. to[nextKey] = nextSource[nextKey];
  26. }
  27. }
  28. }
  29. return to;
  30. }
  31. function polyfill() {
  32. if (!Object.assign) {
  33. Object.defineProperty(Object, 'assign', {
  34. enumerable: false,
  35. configurable: true,
  36. writable: true,
  37. value: assign
  38. });
  39. }
  40. }
  41. module.exports = {
  42. assign: assign,
  43. polyfill: polyfill
  44. };
  45. },{}]},{},[1]);