react 15.0.0-rc.1 → 15.0.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/react-with-addons.js +1446 -1195
  2. package/dist/react-with-addons.min.js +6 -6
  3. package/dist/react.js +1330 -1109
  4. package/dist/react.min.js +6 -6
  5. package/lib/CSSProperty.js +6 -0
  6. package/lib/CSSPropertyOperations.js +31 -15
  7. package/lib/CallbackQueue.js +3 -2
  8. package/lib/DOMChildrenOperations.js +0 -3
  9. package/lib/DOMLazyTree.js +11 -2
  10. package/lib/DOMPropertyOperations.js +0 -46
  11. package/lib/EventPluginUtils.js +2 -2
  12. package/lib/FallbackCompositionState.js +3 -2
  13. package/lib/HTMLDOMPropertyConfig.js +111 -111
  14. package/lib/IOSDefaultEventPluginOrder.js +16 -0
  15. package/lib/IOSNativeBridgeEventPlugin.js +57 -0
  16. package/lib/NativeMethodsMixin.js +165 -0
  17. package/lib/OrderedMap.js +3 -2
  18. package/lib/PanResponder.js +362 -0
  19. package/lib/React.js +68 -9
  20. package/lib/ReactBrowserEventEmitter.js +3 -2
  21. package/lib/ReactCSSTransitionGroup.js +3 -3
  22. package/lib/ReactClass.js +7 -6
  23. package/lib/ReactComponent.js +2 -2
  24. package/lib/ReactCompositeComponent.js +5 -4
  25. package/lib/ReactDOMComponent.js +14 -15
  26. package/lib/ReactDOMDebugTool.js +0 -8
  27. package/lib/ReactDOMEmptyComponent.js +3 -3
  28. package/lib/ReactDOMInput.js +5 -4
  29. package/lib/ReactDOMOption.js +13 -2
  30. package/lib/ReactDOMSelect.js +3 -2
  31. package/lib/ReactDOMTextComponent.js +3 -2
  32. package/lib/ReactDOMTextarea.js +3 -2
  33. package/lib/ReactDebugInstanceMap.js +102 -0
  34. package/lib/ReactDefaultBatchingStrategy.js +3 -2
  35. package/lib/ReactDefaultPerf.js +46 -7
  36. package/lib/ReactDefaultPerfAnalysis.js +7 -7
  37. package/lib/ReactElement.js +5 -4
  38. package/lib/ReactEventListener.js +3 -2
  39. package/lib/ReactMarkupChecksum.js +7 -2
  40. package/lib/ReactMount.js +1 -0
  41. package/lib/ReactNative.js +71 -0
  42. package/lib/ReactNativeAttributePayload.js +397 -0
  43. package/lib/ReactNativeBaseComponent.js +196 -0
  44. package/lib/ReactNativeComponent.js +3 -2
  45. package/lib/ReactNativeComponentEnvironment.js +38 -0
  46. package/lib/ReactNativeComponentTree.js +66 -0
  47. package/lib/ReactNativeContainerInfo.js +21 -0
  48. package/lib/ReactNativeDOMIDOperations.js +83 -0
  49. package/lib/ReactNativeDefaultInjection.js +99 -0
  50. package/lib/ReactNativeEventEmitter.js +180 -0
  51. package/lib/ReactNativeGlobalInteractionHandler.js +33 -0
  52. package/lib/ReactNativeGlobalResponderHandler.js +25 -0
  53. package/lib/ReactNativeMount.js +190 -0
  54. package/lib/ReactNativePropRegistry.js +52 -0
  55. package/lib/ReactNativeReconcileTransaction.js +100 -0
  56. package/lib/ReactNativeTagHandles.js +54 -0
  57. package/lib/ReactNativeTextComponent.js +70 -0
  58. package/lib/ReactNativeTreeTraversal.js +127 -0
  59. package/lib/ReactOwner.js +4 -3
  60. package/lib/ReactPropTransferer.js +4 -3
  61. package/lib/ReactReconcileTransaction.js +3 -3
  62. package/lib/ReactServerRenderingTransaction.js +3 -3
  63. package/lib/ReactSimpleEmptyComponent.js +3 -3
  64. package/lib/ReactTestUtils.js +14 -4
  65. package/lib/ReactTransitionGroup.js +3 -2
  66. package/lib/ReactUMDEntry.js +26 -0
  67. package/lib/ReactUpdateQueue.js +20 -3
  68. package/lib/ReactUpdates.js +3 -2
  69. package/lib/ReactVersion.js +1 -1
  70. package/lib/ReactWithAddons.js +0 -7
  71. package/lib/ReactWithAddonsUMDEntry.js +26 -0
  72. package/lib/ResponderSyntheticEvent.js +1 -1
  73. package/lib/SVGDOMPropertyConfig.js +266 -52
  74. package/lib/SyntheticEvent.js +5 -4
  75. package/lib/TouchHistoryMath.js +99 -0
  76. package/lib/createReactNativeComponentClass.js +42 -0
  77. package/lib/deprecated.js +3 -2
  78. package/lib/findNodeHandle.js +89 -0
  79. package/lib/instantiateReactComponent.js +3 -2
  80. package/lib/reactComponentExpect.js +3 -2
  81. package/lib/setInnerHTML.js +1 -0
  82. package/lib/update.js +4 -3
  83. package/lib/validateDOMNesting.js +3 -2
  84. package/package.json +5 -4
  85. package/addons.js +0 -15
  86. package/lib/Object.assign.js +0 -47
  87. package/lib/React.native.js +0 -5
  88. package/lib/ReactDOM.native.js +0 -12
  89. package/lib/ReactDOMSVGDeprecatedAttributeDevtool.js +0 -61
  90. package/lib/ReactIsomorphic.js +0 -74
@@ -11,9 +11,10 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _assign = require('object-assign');
15
+
14
16
  var PooledClass = require('./PooledClass');
15
17
 
16
- var assign = require('./Object.assign');
17
18
  var emptyFunction = require('fbjs/lib/emptyFunction');
18
19
  var warning = require('fbjs/lib/warning');
19
20
 
@@ -101,7 +102,7 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
101
102
  return this;
102
103
  }
103
104
 
104
- assign(SyntheticEvent.prototype, {
105
+ _assign(SyntheticEvent.prototype, {
105
106
 
106
107
  preventDefault: function () {
107
108
  this.defaultPrevented = true;
@@ -211,11 +212,11 @@ SyntheticEvent.augmentClass = function (Class, Interface) {
211
212
  E.prototype = Super.prototype;
212
213
  var prototype = new E();
213
214
 
214
- assign(prototype, Class.prototype);
215
+ _assign(prototype, Class.prototype);
215
216
  Class.prototype = prototype;
216
217
  Class.prototype.constructor = Class;
217
218
 
218
- Class.Interface = assign({}, Super.Interface, Interface);
219
+ Class.Interface = _assign({}, Super.Interface, Interface);
219
220
  Class.augmentClass = Super.augmentClass;
220
221
 
221
222
  PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @providesModule TouchHistoryMath
3
+ */
4
+
5
+ 'use strict';
6
+
7
+ var TouchHistoryMath = {
8
+ /**
9
+ * This code is optimized and not intended to look beautiful. This allows
10
+ * computing of touch centroids that have moved after `touchesChangedAfter`
11
+ * timeStamp. You can compute the current centroid involving all touches
12
+ * moves after `touchesChangedAfter`, or you can compute the previous
13
+ * centroid of all touches that were moved after `touchesChangedAfter`.
14
+ *
15
+ * @param {TouchHistoryMath} touchHistory Standard Responder touch track
16
+ * data.
17
+ * @param {number} touchesChangedAfter timeStamp after which moved touches
18
+ * are considered "actively moving" - not just "active".
19
+ * @param {boolean} isXAxis Consider `x` dimension vs. `y` dimension.
20
+ * @param {boolean} ofCurrent Compute current centroid for actively moving
21
+ * touches vs. previous centroid of now actively moving touches.
22
+ * @return {number} value of centroid in specified dimension.
23
+ */
24
+ centroidDimension: function (touchHistory, touchesChangedAfter, isXAxis, ofCurrent) {
25
+ var touchBank = touchHistory.touchBank;
26
+ var total = 0;
27
+ var count = 0;
28
+
29
+ var oneTouchData = touchHistory.numberActiveTouches === 1 ? touchHistory.touchBank[touchHistory.indexOfSingleActiveTouch] : null;
30
+
31
+ if (oneTouchData !== null) {
32
+ if (oneTouchData.touchActive && oneTouchData.currentTimeStamp > touchesChangedAfter) {
33
+ total += ofCurrent && isXAxis ? oneTouchData.currentPageX : ofCurrent && !isXAxis ? oneTouchData.currentPageY : !ofCurrent && isXAxis ? oneTouchData.previousPageX : oneTouchData.previousPageY;
34
+ count = 1;
35
+ }
36
+ } else {
37
+ for (var i = 0; i < touchBank.length; i++) {
38
+ var touchTrack = touchBank[i];
39
+ if (touchTrack !== null && touchTrack !== undefined && touchTrack.touchActive && touchTrack.currentTimeStamp >= touchesChangedAfter) {
40
+ var toAdd; // Yuck, program temporarily in invalid state.
41
+ if (ofCurrent && isXAxis) {
42
+ toAdd = touchTrack.currentPageX;
43
+ } else if (ofCurrent && !isXAxis) {
44
+ toAdd = touchTrack.currentPageY;
45
+ } else if (!ofCurrent && isXAxis) {
46
+ toAdd = touchTrack.previousPageX;
47
+ } else {
48
+ toAdd = touchTrack.previousPageY;
49
+ }
50
+ total += toAdd;
51
+ count++;
52
+ }
53
+ }
54
+ }
55
+ return count > 0 ? total / count : TouchHistoryMath.noCentroid;
56
+ },
57
+
58
+ currentCentroidXOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
59
+ return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, true, // isXAxis
60
+ true // ofCurrent
61
+ );
62
+ },
63
+
64
+ currentCentroidYOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
65
+ return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, false, // isXAxis
66
+ true // ofCurrent
67
+ );
68
+ },
69
+
70
+ previousCentroidXOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
71
+ return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, true, // isXAxis
72
+ false // ofCurrent
73
+ );
74
+ },
75
+
76
+ previousCentroidYOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
77
+ return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, false, // isXAxis
78
+ false // ofCurrent
79
+ );
80
+ },
81
+
82
+ currentCentroidX: function (touchHistory) {
83
+ return TouchHistoryMath.centroidDimension(touchHistory, 0, // touchesChangedAfter
84
+ true, // isXAxis
85
+ true // ofCurrent
86
+ );
87
+ },
88
+
89
+ currentCentroidY: function (touchHistory) {
90
+ return TouchHistoryMath.centroidDimension(touchHistory, 0, // touchesChangedAfter
91
+ false, // isXAxis
92
+ true // ofCurrent
93
+ );
94
+ },
95
+
96
+ noCentroid: -1
97
+ };
98
+
99
+ module.exports = TouchHistoryMath;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule createReactNativeComponentClass
10
+ *
11
+ */
12
+
13
+ 'use strict';
14
+
15
+ var ReactNativeBaseComponent = require('./ReactNativeBaseComponent');
16
+
17
+ // See also ReactNativeBaseComponent
18
+
19
+
20
+ /**
21
+ * @param {string} config iOS View configuration.
22
+ * @private
23
+ */
24
+ var createReactNativeComponentClass = function (viewConfig) {
25
+ var Constructor = function (element) {
26
+ this._currentElement = element;
27
+ this._topLevelWrapper = null;
28
+ this._nativeParent = null;
29
+ this._nativeContainerInfo = null;
30
+ this._rootNodeID = null;
31
+ this._renderedChildren = null;
32
+ };
33
+ Constructor.displayName = viewConfig.uiViewClassName;
34
+ Constructor.viewConfig = viewConfig;
35
+ Constructor.propTypes = viewConfig.propTypes;
36
+ Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
37
+ Constructor.prototype.constructor = Constructor;
38
+
39
+ return Constructor;
40
+ };
41
+
42
+ module.exports = createReactNativeComponentClass;
package/lib/deprecated.js CHANGED
@@ -11,7 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var assign = require('./Object.assign');
14
+ var _assign = require('object-assign');
15
+
15
16
  var warning = require('fbjs/lib/warning');
16
17
 
17
18
  /**
@@ -41,7 +42,7 @@ function deprecated(fnName, newModule, newPackage, ctx, fn) {
41
42
  };
42
43
  // We need to make sure all properties of the original fn are copied over.
43
44
  // In particular, this is needed to support PropTypes
44
- return assign(newFn, fn);
45
+ return _assign(newFn, fn);
45
46
  }
46
47
 
47
48
  return fn;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule findNodeHandle
10
+ *
11
+ */
12
+
13
+ 'use strict';
14
+
15
+ var ReactCurrentOwner = require('./ReactCurrentOwner');
16
+ var ReactInstanceMap = require('./ReactInstanceMap');
17
+
18
+ var invariant = require('fbjs/lib/invariant');
19
+ var warning = require('fbjs/lib/warning');
20
+
21
+ /**
22
+ * ReactNative vs ReactWeb
23
+ * -----------------------
24
+ * React treats some pieces of data opaquely. This means that the information
25
+ * is first class (it can be passed around), but cannot be inspected. This
26
+ * allows us to build infrastructure that reasons about resources, without
27
+ * making assumptions about the nature of those resources, and this allows that
28
+ * infra to be shared across multiple platforms, where the resources are very
29
+ * different. General infra (such as `ReactMultiChild`) reasons opaquely about
30
+ * the data, but platform specific code (such as `ReactNativeBaseComponent`) can
31
+ * make assumptions about the data.
32
+ *
33
+ *
34
+ * `rootNodeID`, uniquely identifies a position in the generated native view
35
+ * tree. Many layers of composite components (created with `React.createClass`)
36
+ * can all share the same `rootNodeID`.
37
+ *
38
+ * `nodeHandle`: A sufficiently unambiguous way to refer to a lower level
39
+ * resource (dom node, native view etc). The `rootNodeID` is sufficient for web
40
+ * `nodeHandle`s, because the position in a tree is always enough to uniquely
41
+ * identify a DOM node (we never have nodes in some bank outside of the
42
+ * document). The same would be true for `ReactNative`, but we must maintain a
43
+ * mapping that we can send efficiently serializable
44
+ * strings across native boundaries.
45
+ *
46
+ * Opaque name TodaysWebReact FutureWebWorkerReact ReactNative
47
+ * ----------------------------------------------------------------------------
48
+ * nodeHandle N/A rootNodeID tag
49
+ */
50
+
51
+ function findNodeHandle(componentOrHandle) {
52
+ if (process.env.NODE_ENV !== 'production') {
53
+ var owner = ReactCurrentOwner.current;
54
+ if (owner !== null) {
55
+ process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findNodeHandle inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
56
+ owner._warnedAboutRefsInRender = true;
57
+ }
58
+ }
59
+ if (componentOrHandle == null) {
60
+ return null;
61
+ }
62
+ if (typeof componentOrHandle === 'number') {
63
+ // Already a node handle
64
+ return componentOrHandle;
65
+ }
66
+
67
+ var component = componentOrHandle;
68
+
69
+ // TODO (balpert): Wrap iOS native components in a composite wrapper, then
70
+ // ReactInstanceMap.get here will always succeed for mounted components
71
+ var internalInstance = ReactInstanceMap.get(component);
72
+ if (internalInstance) {
73
+ return internalInstance.getNativeNode();
74
+ } else {
75
+ var rootNodeID = component._rootNodeID;
76
+ if (rootNodeID) {
77
+ return rootNodeID;
78
+ } else {
79
+ !(
80
+ // Native
81
+ typeof component === 'object' && '_rootNodeID' in component ||
82
+ // Composite
83
+ component.render != null && typeof component.render === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findNodeHandle(...): Argument is not a component ' + '(type: %s, keys: %s)', typeof component, Object.keys(component)) : invariant(false) : void 0;
84
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findNodeHandle(...): Unable to find node handle for unmounted ' + 'component.') : invariant(false) : void 0;
85
+ }
86
+ }
87
+ }
88
+
89
+ module.exports = findNodeHandle;
@@ -11,11 +11,12 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _assign = require('object-assign');
15
+
14
16
  var ReactCompositeComponent = require('./ReactCompositeComponent');
15
17
  var ReactEmptyComponent = require('./ReactEmptyComponent');
16
18
  var ReactNativeComponent = require('./ReactNativeComponent');
17
19
 
18
- var assign = require('./Object.assign');
19
20
  var invariant = require('fbjs/lib/invariant');
20
21
  var warning = require('fbjs/lib/warning');
21
22
 
@@ -23,7 +24,7 @@ var warning = require('fbjs/lib/warning');
23
24
  var ReactCompositeComponentWrapper = function (element) {
24
25
  this.construct(element);
25
26
  };
26
- assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
27
+ _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
27
28
  _instantiateReactComponent: instantiateReactComponent
28
29
  });
29
30
 
@@ -12,10 +12,11 @@
12
12
 
13
13
  'use strict';
14
14
 
15
+ var _assign = require('object-assign');
16
+
15
17
  var ReactInstanceMap = require('./ReactInstanceMap');
16
18
  var ReactTestUtils = require('./ReactTestUtils');
17
19
 
18
- var assign = require('./Object.assign');
19
20
  var invariant = require('fbjs/lib/invariant');
20
21
 
21
22
  function reactComponentExpect(instance) {
@@ -44,7 +45,7 @@ function reactComponentExpectInternal(internalInstance) {
44
45
  this._instance = internalInstance;
45
46
  }
46
47
 
47
- assign(reactComponentExpectInternal.prototype, {
48
+ _assign(reactComponentExpectInternal.prototype, {
48
49
  // Getters -------------------------------------------------------------------
49
50
 
50
51
  /**
@@ -76,6 +76,7 @@ if (ExecutionEnvironment.canUseDOM) {
76
76
  }
77
77
  };
78
78
  }
79
+ testElement = null;
79
80
  }
80
81
 
81
82
  module.exports = setInnerHTML;
package/lib/update.js CHANGED
@@ -13,7 +13,8 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- var assign = require('./Object.assign');
16
+ var _assign = require('object-assign');
17
+
17
18
  var keyOf = require('fbjs/lib/keyOf');
18
19
  var invariant = require('fbjs/lib/invariant');
19
20
  var hasOwnProperty = {}.hasOwnProperty;
@@ -22,7 +23,7 @@ function shallowCopy(x) {
22
23
  if (Array.isArray(x)) {
23
24
  return x.concat();
24
25
  } else if (x && typeof x === 'object') {
25
- return assign(new x.constructor(), x);
26
+ return _assign(new x.constructor(), x);
26
27
  } else {
27
28
  return x;
28
29
  }
@@ -64,7 +65,7 @@ function update(value, spec) {
64
65
  var mergeObj = spec[COMMAND_MERGE];
65
66
  !(mergeObj && typeof mergeObj === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) : void 0;
66
67
  !(nextValue && typeof nextValue === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) : void 0;
67
- assign(nextValue, spec[COMMAND_MERGE]);
68
+ _assign(nextValue, spec[COMMAND_MERGE]);
68
69
  }
69
70
 
70
71
  if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
@@ -11,7 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var assign = require('./Object.assign');
14
+ var _assign = require('object-assign');
15
+
15
16
  var emptyFunction = require('fbjs/lib/emptyFunction');
16
17
  var warning = require('fbjs/lib/warning');
17
18
 
@@ -60,7 +61,7 @@ if (process.env.NODE_ENV !== 'production') {
60
61
  };
61
62
 
62
63
  var updatedAncestorInfo = function (oldInfo, tag, instance) {
63
- var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
64
+ var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
64
65
  var info = { tag: tag, instance: instance };
65
66
 
66
67
  if (inScopeTags.indexOf(tag) !== -1) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react",
3
3
  "description": "React is a JavaScript library for building user interfaces.",
4
- "version": "15.0.0-rc.1",
4
+ "version": "15.0.2-alpha.1",
5
5
  "keywords": [
6
6
  "react"
7
7
  ],
@@ -23,12 +23,13 @@
23
23
  "node": ">=0.10.0"
24
24
  },
25
25
  "dependencies": {
26
- "envify": "^3.0.0",
27
- "fbjs": "^0.8.0-alpha.2"
26
+ "fbjs": "^0.8.0",
27
+ "loose-envify": "^1.1.0",
28
+ "object-assign": "^4.0.1"
28
29
  },
29
30
  "browserify": {
30
31
  "transform": [
31
- "envify"
32
+ "loose-envify"
32
33
  ]
33
34
  }
34
35
  }
package/addons.js DELETED
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- var warning = require('fbjs/lib/warning');
4
- warning(
5
- false,
6
- /* eslint-disable no-useless-concat */
7
- // Require examples in this string must be split to prevent React's
8
- // build tools from mistaking them for real requires.
9
- // Otherwise the build tools will attempt to build a 'react-addons-{addon}' module.
10
- 'require' + "('react/addons') is deprecated. " +
11
- 'Access using require' + "('react-addons-{addon}') instead."
12
- );
13
- /* eslint-enable no-useless-concat */
14
-
15
- module.exports = require('./lib/ReactWithAddons');
@@ -1,47 +0,0 @@
1
- /**
2
- * Copyright 2014-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule Object.assign
10
- */
11
-
12
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
13
-
14
- 'use strict';
15
-
16
- function assign(target, sources) {
17
- if (target == null) {
18
- throw new TypeError('Object.assign target cannot be null or undefined');
19
- }
20
-
21
- var to = Object(target);
22
- var hasOwnProperty = Object.prototype.hasOwnProperty;
23
-
24
- for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
25
- var nextSource = arguments[nextIndex];
26
- if (nextSource == null) {
27
- continue;
28
- }
29
-
30
- var from = Object(nextSource);
31
-
32
- // We don't currently support accessors nor proxies. Therefore this
33
- // copy cannot throw. If we ever supported this then we must handle
34
- // exceptions and side-effects. We don't support symbols so they won't
35
- // be transferred.
36
-
37
- for (var key in from) {
38
- if (hasOwnProperty.call(from, key)) {
39
- to[key] = from[key];
40
- }
41
- }
42
- }
43
-
44
- return to;
45
- }
46
-
47
- module.exports = assign;