object-assign.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ObjectAssign = f()}})(function(){var define,module,exports;return (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. /**
  3. * Code refactored from Mozilla Developer Network:
  4. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
  5. */
  6. 'use strict';
  7. function assign(target, firstSource) {
  8. if (target === undefined || target === null) {
  9. throw new TypeError('Cannot convert first argument to object');
  10. }
  11. var to = Object(target);
  12. for (var i = 1; i < arguments.length; i++) {
  13. var nextSource = arguments[i];
  14. if (nextSource === undefined || nextSource === null) {
  15. continue;
  16. }
  17. var keysArray = Object.keys(Object(nextSource));
  18. for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
  19. var nextKey = keysArray[nextIndex];
  20. var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
  21. if (desc !== undefined && desc.enumerable) {
  22. to[nextKey] = nextSource[nextKey];
  23. }
  24. }
  25. }
  26. return to;
  27. }
  28. function polyfill() {
  29. if (!Object.assign) {
  30. Object.defineProperty(Object, 'assign', {
  31. enumerable: false,
  32. configurable: true,
  33. writable: true,
  34. value: assign
  35. });
  36. }
  37. }
  38. module.exports = {
  39. assign: assign,
  40. polyfill: polyfill
  41. };
  42. },{}]},{},[1])(1)
  43. });