react 0.9.0-rc1 → 0.11.0-rc1

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 (168) hide show
  1. package/README.md +3 -0
  2. package/dist/JSXTransformer.js +13445 -0
  3. package/dist/react-with-addons.js +20226 -0
  4. package/dist/react-with-addons.min.js +22 -0
  5. package/dist/react.js +18434 -0
  6. package/dist/react.min.js +21 -0
  7. package/lib/AutoFocusMixin.js +4 -2
  8. package/lib/BeforeInputEventPlugin.js +222 -0
  9. package/lib/CSSCore.js +1 -1
  10. package/lib/CSSProperty.js +1 -1
  11. package/lib/CSSPropertyOperations.js +4 -4
  12. package/lib/{ReactMountReady.js → CallbackQueue.js} +33 -25
  13. package/lib/ChangeEventPlugin.js +2 -2
  14. package/lib/ClientReactRootIndex.js +1 -1
  15. package/lib/CompositionEventPlugin.js +6 -2
  16. package/lib/DOMChildrenOperations.js +34 -21
  17. package/lib/DOMProperty.js +52 -22
  18. package/lib/DOMPropertyOperations.js +29 -17
  19. package/lib/Danger.js +1 -1
  20. package/lib/DefaultEventPluginOrder.js +2 -1
  21. package/lib/EnterLeaveEventPlugin.js +1 -1
  22. package/lib/EventConstants.js +2 -1
  23. package/lib/EventListener.js +5 -2
  24. package/lib/EventPluginHub.js +5 -6
  25. package/lib/EventPluginRegistry.js +27 -4
  26. package/lib/EventPluginUtils.js +12 -2
  27. package/lib/EventPropagators.js +1 -1
  28. package/lib/ExecutionEnvironment.js +9 -3
  29. package/lib/{DefaultDOMPropertyConfig.js → HTMLDOMPropertyConfig.js} +47 -58
  30. package/lib/LinkedStateMixin.js +1 -1
  31. package/lib/LinkedValueUtils.js +27 -29
  32. package/lib/LocalEventTrapMixin.js +52 -0
  33. package/lib/MobileSafariClickEventPlugin.js +1 -1
  34. package/lib/PooledClass.js +1 -1
  35. package/lib/React.js +39 -4
  36. package/lib/ReactBrowserComponentMixin.js +46 -0
  37. package/lib/{ReactEventEmitter.js → ReactBrowserEventEmitter.js} +118 -95
  38. package/lib/ReactCSSTransitionGroup.js +13 -11
  39. package/lib/ReactCSSTransitionGroupChild.js +3 -6
  40. package/lib/ReactChildren.js +35 -14
  41. package/lib/ReactComponent.js +120 -224
  42. package/lib/ReactComponentBrowserEnvironment.js +4 -37
  43. package/lib/ReactComponentWithPureRenderMixin.js +54 -0
  44. package/lib/ReactCompositeComponent.js +250 -288
  45. package/lib/ReactContext.js +1 -1
  46. package/lib/ReactCurrentOwner.js +1 -1
  47. package/lib/ReactDOM.js +26 -24
  48. package/lib/ReactDOMButton.js +3 -2
  49. package/lib/ReactDOMComponent.js +43 -24
  50. package/lib/ReactDOMForm.js +8 -13
  51. package/lib/ReactDOMIDOperations.js +3 -32
  52. package/lib/ReactDOMImg.js +8 -14
  53. package/lib/ReactDOMInput.js +3 -2
  54. package/lib/ReactDOMOption.js +12 -8
  55. package/lib/ReactDOMSelect.js +19 -17
  56. package/lib/ReactDOMSelection.js +36 -11
  57. package/lib/ReactDOMTextarea.js +10 -8
  58. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  59. package/lib/ReactDefaultInjection.js +28 -15
  60. package/lib/ReactDefaultPerf.js +29 -12
  61. package/lib/ReactDefaultPerfAnalysis.js +5 -1
  62. package/lib/ReactDescriptor.js +243 -0
  63. package/lib/ReactDescriptorValidator.js +283 -0
  64. package/lib/ReactEmptyComponent.js +78 -0
  65. package/lib/ReactErrorUtils.js +1 -1
  66. package/lib/ReactEventEmitterMixin.js +2 -4
  67. package/lib/ReactEventListener.js +189 -0
  68. package/lib/ReactInjection.js +9 -3
  69. package/lib/ReactInputSelection.js +3 -2
  70. package/lib/ReactInstanceHandles.js +1 -1
  71. package/lib/ReactLink.js +25 -1
  72. package/lib/ReactMarkupChecksum.js +1 -1
  73. package/lib/ReactMount.js +62 -22
  74. package/lib/ReactMultiChild.js +19 -14
  75. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  76. package/lib/ReactOwner.js +7 -2
  77. package/lib/ReactPerf.js +1 -1
  78. package/lib/ReactPropTransferer.js +45 -30
  79. package/lib/ReactPropTypeLocationNames.js +1 -1
  80. package/lib/ReactPropTypeLocations.js +1 -1
  81. package/lib/ReactPropTypes.js +222 -238
  82. package/lib/ReactPutListenerQueue.js +3 -3
  83. package/lib/ReactReconcileTransaction.js +22 -21
  84. package/lib/ReactRootIndex.js +1 -1
  85. package/lib/ReactServerRendering.js +42 -12
  86. package/lib/ReactServerRenderingTransaction.js +115 -0
  87. package/lib/ReactStateSetters.js +1 -1
  88. package/lib/ReactTestUtils.js +412 -0
  89. package/lib/ReactTextComponent.js +22 -14
  90. package/lib/ReactTransitionChildMapping.js +3 -3
  91. package/lib/ReactTransitionEvents.js +20 -1
  92. package/lib/ReactTransitionGroup.js +10 -7
  93. package/lib/ReactUpdates.js +140 -23
  94. package/lib/ReactWithAddons.js +13 -3
  95. package/lib/SVGDOMPropertyConfig.js +97 -0
  96. package/lib/SelectEventPlugin.js +1 -1
  97. package/lib/ServerReactRootIndex.js +1 -1
  98. package/lib/SimpleEventPlugin.js +8 -2
  99. package/lib/SyntheticClipboardEvent.js +1 -1
  100. package/lib/SyntheticCompositionEvent.js +1 -1
  101. package/lib/SyntheticDragEvent.js +1 -1
  102. package/lib/SyntheticEvent.js +1 -1
  103. package/lib/SyntheticFocusEvent.js +1 -1
  104. package/lib/SyntheticInputEvent.js +52 -0
  105. package/lib/SyntheticKeyboardEvent.js +34 -5
  106. package/lib/SyntheticMouseEvent.js +4 -1
  107. package/lib/SyntheticTouchEvent.js +5 -2
  108. package/lib/SyntheticUIEvent.js +25 -3
  109. package/lib/SyntheticWheelEvent.js +1 -1
  110. package/lib/Transaction.js +1 -33
  111. package/lib/ViewportMetrics.js +1 -1
  112. package/lib/accumulate.js +1 -1
  113. package/lib/adler32.js +1 -1
  114. package/lib/cloneWithProps.js +11 -9
  115. package/lib/containsNode.js +1 -1
  116. package/lib/copyProperties.js +1 -1
  117. package/lib/createArrayFrom.js +1 -1
  118. package/lib/createFullPageComponent.js +2 -2
  119. package/lib/createNodesFromMarkup.js +1 -1
  120. package/lib/cx.js +1 -1
  121. package/lib/dangerousStyleValue.js +12 -6
  122. package/lib/emptyFunction.js +1 -1
  123. package/lib/{ReactComponentEnvironment.js → emptyObject.js} +7 -6
  124. package/lib/escapeTextForBrowser.js +3 -4
  125. package/lib/flattenChildren.js +10 -8
  126. package/lib/focusNode.js +33 -0
  127. package/lib/forEachAccumulated.js +1 -1
  128. package/lib/getActiveElement.js +1 -1
  129. package/lib/getEventKey.js +36 -6
  130. package/lib/getEventModifierState.js +52 -0
  131. package/lib/getEventTarget.js +1 -1
  132. package/lib/getMarkupWrap.js +3 -1
  133. package/lib/getNodeForCharacterOffset.js +1 -1
  134. package/lib/getReactRootElementInContainer.js +1 -1
  135. package/lib/getTextContentAccessor.js +2 -2
  136. package/lib/getUnboundedScrollPosition.js +1 -1
  137. package/lib/hyphenate.js +4 -1
  138. package/lib/hyphenateStyleName.js +46 -0
  139. package/lib/instantiateReactComponent.js +62 -0
  140. package/lib/invariant.js +21 -23
  141. package/lib/isEventSupported.js +1 -1
  142. package/lib/isNode.js +2 -2
  143. package/lib/isTextInputElement.js +1 -1
  144. package/lib/isTextNode.js +1 -1
  145. package/lib/joinClasses.js +1 -1
  146. package/lib/keyMirror.js +1 -1
  147. package/lib/keyOf.js +1 -1
  148. package/lib/{objMap.js → mapObject.js} +9 -4
  149. package/lib/memoizeStringOnly.js +1 -1
  150. package/lib/merge.js +1 -1
  151. package/lib/mergeHelpers.js +12 -1
  152. package/lib/mergeInto.js +4 -3
  153. package/lib/mixInto.js +1 -1
  154. package/lib/monitorCodeUse.js +37 -0
  155. package/lib/onlyChild.js +4 -4
  156. package/lib/performance.js +33 -0
  157. package/lib/performanceNow.js +6 -15
  158. package/lib/setInnerHTML.js +77 -0
  159. package/lib/shallowEqual.js +1 -1
  160. package/lib/shouldUpdateReactComponent.js +15 -29
  161. package/lib/toArray.js +1 -1
  162. package/lib/traverseAllChildren.js +10 -6
  163. package/lib/update.js +171 -0
  164. package/lib/warning.js +19 -11
  165. package/package.json +5 -3
  166. package/lib/ReactEventTopLevelCallback.js +0 -109
  167. package/lib/createObjectFrom.js +0 -61
  168. package/lib/objMapKeyVal.js +0 -47
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ var shouldWrap = {
37
37
  // they will be initialized in the wrong namespace (and will not display).
38
38
  'circle': true,
39
39
  'defs': true,
40
+ 'ellipse': true,
40
41
  'g': true,
41
42
  'line': true,
42
43
  'linearGradient': true,
@@ -78,6 +79,7 @@ var markupWrap = {
78
79
 
79
80
  'circle': svgWrap,
80
81
  'defs': svgWrap,
82
+ 'ellipse': svgWrap,
81
83
  'g': svgWrap,
82
84
  'line': svgWrap,
83
85
  'linearGradient': svgWrap,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ function getTextContentAccessor() {
32
32
  if (!contentKey && ExecutionEnvironment.canUseDOM) {
33
33
  // Prefer textContent to innerText because many browsers support both but
34
34
  // SVG <text> elements don't support innerText even when <div> does.
35
- contentKey = 'textContent' in document.createElement('div') ?
35
+ contentKey = 'textContent' in document.documentElement ?
36
36
  'textContent' :
37
37
  'innerText';
38
38
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
package/lib/hyphenate.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -25,6 +25,9 @@ var _uppercasePattern = /([A-Z])/g;
25
25
  * > hyphenate('backgroundColor')
26
26
  * < "background-color"
27
27
  *
28
+ * For CSS style names, use `hyphenateStyleName` instead which works properly
29
+ * with all vendor prefixes, including `ms`.
30
+ *
28
31
  * @param {string} string
29
32
  * @return {string}
30
33
  */
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Copyright 2013-2014 Facebook, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * @providesModule hyphenateStyleName
17
+ * @typechecks
18
+ */
19
+
20
+ "use strict";
21
+
22
+ var hyphenate = require("./hyphenate");
23
+
24
+ var msPattern = /^ms-/;
25
+
26
+ /**
27
+ * Hyphenates a camelcased CSS property name, for example:
28
+ *
29
+ * > hyphenate('backgroundColor')
30
+ * < "background-color"
31
+ * > hyphenate('MozTransition')
32
+ * < "-moz-transition"
33
+ * > hyphenate('msTransition')
34
+ * < "-ms-transition"
35
+ *
36
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
37
+ * is converted to `-ms-`.
38
+ *
39
+ * @param {string} string
40
+ * @return {string}
41
+ */
42
+ function hyphenateStyleName(string) {
43
+ return hyphenate(string).replace(msPattern, '-ms-');
44
+ }
45
+
46
+ module.exports = hyphenateStyleName;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Copyright 2013-2014 Facebook, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * @providesModule instantiateReactComponent
17
+ * @typechecks static-only
18
+ */
19
+
20
+ "use strict";
21
+
22
+ var invariant = require("./invariant");
23
+
24
+ /**
25
+ * Validate a `componentDescriptor`. This should be exposed publicly in a follow
26
+ * up diff.
27
+ *
28
+ * @param {object} descriptor
29
+ * @return {boolean} Returns true if this is a valid descriptor of a Component.
30
+ */
31
+ function isValidComponentDescriptor(descriptor) {
32
+ return (
33
+ descriptor &&
34
+ typeof descriptor.type === 'function' &&
35
+ typeof descriptor.type.prototype.mountComponent === 'function' &&
36
+ typeof descriptor.type.prototype.receiveComponent === 'function'
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Given a `componentDescriptor` create an instance that will actually be
42
+ * mounted. Currently it just extracts an existing clone from composite
43
+ * components but this is an implementation detail which will change.
44
+ *
45
+ * @param {object} descriptor
46
+ * @return {object} A new instance of componentDescriptor's constructor.
47
+ * @protected
48
+ */
49
+ function instantiateReactComponent(descriptor) {
50
+
51
+ // TODO: Make warning
52
+ // if (__DEV__) {
53
+ ("production" !== process.env.NODE_ENV ? invariant(
54
+ isValidComponentDescriptor(descriptor),
55
+ 'Only React Components are valid for mounting.'
56
+ ) : invariant(isValidComponentDescriptor(descriptor)));
57
+ // }
58
+
59
+ return new descriptor.type(descriptor);
60
+ }
61
+
62
+ module.exports = instantiateReactComponent;
package/lib/invariant.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
16
16
  * @providesModule invariant
17
17
  */
18
18
 
19
+ "use strict";
20
+
19
21
  /**
20
22
  * Use invariant() to assert state which your program assumes to be true.
21
23
  *
@@ -27,36 +29,32 @@
27
29
  * will remain to ensure logic does not differ in production.
28
30
  */
29
31
 
30
- function invariant(condition) {
31
- if (!condition) {
32
- var error = new Error(
33
- 'Minified exception occured; use the non-minified dev environment for ' +
34
- 'the full error message and additional helpful warnings.'
35
- );
36
- error.framesToPop = 1;
37
- throw error;
38
- }
39
- }
40
-
41
- module.exports = invariant;
42
-
43
- if ("production" !== process.env.NODE_ENV) {
44
- var invariantDev = function(condition, format, a, b, c, d, e, f) {
32
+ var invariant = function(condition, format, a, b, c, d, e, f) {
33
+ if ("production" !== process.env.NODE_ENV) {
45
34
  if (format === undefined) {
46
35
  throw new Error('invariant requires an error message argument');
47
36
  }
37
+ }
48
38
 
49
- if (!condition) {
39
+ if (!condition) {
40
+ var error;
41
+ if (format === undefined) {
42
+ error = new Error(
43
+ 'Minified exception occurred; use the non-minified dev environment ' +
44
+ 'for the full error message and additional helpful warnings.'
45
+ );
46
+ } else {
50
47
  var args = [a, b, c, d, e, f];
51
48
  var argIndex = 0;
52
- var error = new Error(
49
+ error = new Error(
53
50
  'Invariant Violation: ' +
54
51
  format.replace(/%s/g, function() { return args[argIndex++]; })
55
52
  );
56
- error.framesToPop = 1; // we don't care about invariant's own frame
57
- throw error;
58
53
  }
59
- };
60
54
 
61
- module.exports = invariantDev;
62
- }
55
+ error.framesToPop = 1; // we don't care about invariant's own frame
56
+ throw error;
57
+ }
58
+ };
59
+
60
+ module.exports = invariant;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
package/lib/isNode.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@
23
23
  */
24
24
  function isNode(object) {
25
25
  return !!(object && (
26
- typeof Node !== 'undefined' ? object instanceof Node :
26
+ typeof Node === 'function' ? object instanceof Node :
27
27
  typeof object === 'object' &&
28
28
  typeof object.nodeType === 'number' &&
29
29
  typeof object.nodeName === 'string'
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
package/lib/isTextNode.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
package/lib/keyMirror.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
package/lib/keyOf.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  *
16
- * @providesModule objMap
16
+ * @providesModule mapObject
17
17
  */
18
18
 
19
19
  "use strict";
@@ -25,12 +25,17 @@
25
25
  *
26
26
  * func(value, key, iteration)
27
27
  *
28
+ * Grepable names:
29
+ *
30
+ * function objectMap()
31
+ * function objMap()
32
+ *
28
33
  * @param {?object} obj Object to map keys over
29
34
  * @param {function} func Invoked for each key/val pair.
30
35
  * @param {?*} context
31
36
  * @return {?object} Result of mapping or null if obj is falsey
32
37
  */
33
- function objMap(obj, func, context) {
38
+ function mapObject(obj, func, context) {
34
39
  if (!obj) {
35
40
  return null;
36
41
  }
@@ -44,4 +49,4 @@ function objMap(obj, func, context) {
44
49
  return ret;
45
50
  }
46
51
 
47
- module.exports = objMap;
52
+ module.exports = mapObject;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
package/lib/merge.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -92,6 +92,17 @@ var mergeHelpers = {
92
92
  ) : invariant(!isTerminal(arg) && !Array.isArray(arg)));
93
93
  },
94
94
 
95
+ /**
96
+ * @param {*} arg
97
+ */
98
+ checkMergeIntoObjectArg: function(arg) {
99
+ ("production" !== process.env.NODE_ENV ? invariant(
100
+ (!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg),
101
+ 'Tried to merge into an object, instead got %s.',
102
+ arg
103
+ ) : invariant((!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg)));
104
+ },
105
+
95
106
  /**
96
107
  * Checks that a merge was not given a circular object or an object that had
97
108
  * too great of depth.
package/lib/mergeInto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -22,15 +22,16 @@
22
22
  var mergeHelpers = require("./mergeHelpers");
23
23
 
24
24
  var checkMergeObjectArg = mergeHelpers.checkMergeObjectArg;
25
+ var checkMergeIntoObjectArg = mergeHelpers.checkMergeIntoObjectArg;
25
26
 
26
27
  /**
27
28
  * Shallow merges two structures by mutating the first parameter.
28
29
  *
29
- * @param {object} one Object to be merged into.
30
+ * @param {object|function} one Object to be merged into.
30
31
  * @param {?object} two Optional object with properties to merge from.
31
32
  */
32
33
  function mergeInto(one, two) {
33
- checkMergeObjectArg(one);
34
+ checkMergeIntoObjectArg(one);
34
35
  if (two != null) {
35
36
  checkMergeObjectArg(two);
36
37
  for (var key in two) {
package/lib/mixInto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.