react 0.14.0-beta1 → 0.14.0
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.
- package/addons.js +8 -3
- package/dist/react-with-addons.js +5048 -4095
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +4555 -3729
- package/dist/react.min.js +6 -5
- package/lib/AutoFocusUtils.js +3 -3
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +18 -3
- package/lib/CSSPropertyOperations.js +27 -14
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +15 -14
- package/lib/DOMChildrenOperations.js +22 -7
- package/lib/DOMProperty.js +8 -8
- package/lib/DOMPropertyOperations.js +23 -10
- package/lib/Danger.js +21 -16
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +18 -10
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +29 -21
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +34 -38
- package/lib/EventPropagators.js +8 -8
- package/lib/FallbackCompositionState.js +9 -3
- package/lib/HTMLDOMPropertyConfig.js +24 -4
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +8 -8
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +3 -5
- package/lib/React.js +18 -7
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +36 -7
- package/lib/ReactCSSTransitionGroup.js +35 -9
- package/lib/ReactCSSTransitionGroupChild.js +48 -30
- package/lib/ReactChildReconciler.js +24 -19
- package/lib/ReactChildren.js +72 -32
- package/lib/ReactClass.js +46 -46
- package/lib/ReactComponent.js +18 -16
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +95 -44
- package/lib/ReactDOM.js +74 -159
- package/lib/ReactDOMComponent.js +235 -93
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/{emptyObject.js → ReactDOMFeatureFlags.js} +6 -8
- package/lib/ReactDOMIDOperations.js +8 -81
- package/lib/ReactDOMInput.js +18 -9
- package/lib/ReactDOMOption.js +7 -7
- package/lib/ReactDOMSelect.js +9 -9
- package/lib/ReactDOMSelection.js +19 -3
- package/lib/ReactDOMServer.js +5 -3
- package/lib/ReactDOMTextComponent.js +33 -20
- package/lib/ReactDOMTextarea.js +14 -12
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +23 -25
- package/lib/ReactDefaultPerf.js +17 -11
- package/lib/ReactDefaultPerfAnalysis.js +13 -12
- package/lib/ReactElement.js +85 -39
- package/lib/ReactElementValidator.js +47 -90
- package/lib/ReactEmptyComponent.js +26 -62
- package/lib/ReactEmptyComponentRegistry.js +48 -0
- package/lib/ReactErrorUtils.js +53 -9
- package/lib/ReactEventEmitterMixin.js +2 -2
- package/lib/ReactEventListener.js +33 -21
- package/lib/ReactFragment.js +27 -118
- package/lib/ReactInjection.js +10 -12
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -11
- package/lib/ReactIsomorphic.js +15 -11
- package/lib/ReactLink.js +2 -2
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +186 -85
- package/lib/ReactMultiChild.js +119 -25
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -3
- package/lib/ReactNoopUpdateQueue.js +3 -3
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +38 -9
- package/lib/ReactReconcileTransaction.js +10 -8
- package/lib/ReactReconciler.js +5 -6
- package/lib/ReactRef.js +14 -2
- package/lib/ReactServerBatchingStrategy.js +5 -5
- package/lib/ReactServerRendering.js +12 -12
- package/lib/ReactServerRenderingTransaction.js +6 -5
- package/lib/ReactTestUtils.js +47 -39
- package/lib/ReactTransitionChildMapping.js +3 -6
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +19 -19
- package/lib/ReactUpdates.js +15 -15
- package/lib/{performance.js → ReactVersion.js} +3 -12
- package/lib/ReactWithAddons.js +24 -15
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +19 -9
- package/lib/SimpleEventPlugin.js +198 -43
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +18 -4
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +1 -1
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +3 -3
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +7 -7
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +11 -6
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +7 -6
- package/lib/findDOMNode.js +9 -9
- package/lib/flattenChildren.js +4 -4
- package/lib/getEventKey.js +1 -1
- package/lib/{isTextNode.js → getTestDocument.js} +7 -11
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +15 -17
- package/lib/isEventSupported.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +216 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +1 -1
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/shouldUpdateReactComponent.js +12 -8
- package/lib/sliceChildren.js +34 -0
- package/lib/traverseAllChildren.js +25 -18
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +6 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +1 -51
- package/dist/JSXTransformer.js +0 -17588
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/ReactDOMClient.js +0 -90
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -93
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/joinClasses.js +0 -39
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/memoizeStringOnly.js +0 -31
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -57
package/lib/joinClasses.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-2015, 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 joinClasses
|
|
10
|
-
* @typechecks static-only
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Combines multiple className strings into one.
|
|
17
|
-
* http://jsperf.com/joinclasses-args-vs-array
|
|
18
|
-
*
|
|
19
|
-
* @param {...?string} className
|
|
20
|
-
* @return {string}
|
|
21
|
-
*/
|
|
22
|
-
function joinClasses(className /*, ... */) {
|
|
23
|
-
if (!className) {
|
|
24
|
-
className = '';
|
|
25
|
-
}
|
|
26
|
-
var nextClass;
|
|
27
|
-
var argLength = arguments.length;
|
|
28
|
-
if (argLength > 1) {
|
|
29
|
-
for (var ii = 1; ii < argLength; ii++) {
|
|
30
|
-
nextClass = arguments[ii];
|
|
31
|
-
if (nextClass) {
|
|
32
|
-
className = (className ? className + ' ' : '') + nextClass;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return className;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
module.exports = joinClasses;
|
package/lib/keyMirror.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-2015, 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 keyMirror
|
|
10
|
-
* @typechecks static-only
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
var invariant = require("./invariant");
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Constructs an enumeration with keys equal to their value.
|
|
19
|
-
*
|
|
20
|
-
* For example:
|
|
21
|
-
*
|
|
22
|
-
* var COLORS = keyMirror({blue: null, red: null});
|
|
23
|
-
* var myColor = COLORS.blue;
|
|
24
|
-
* var isColorValid = !!COLORS[myColor];
|
|
25
|
-
*
|
|
26
|
-
* The last line could not be performed if the values of the generated enum were
|
|
27
|
-
* not equal to their keys.
|
|
28
|
-
*
|
|
29
|
-
* Input: {key1: val1, key2: val2}
|
|
30
|
-
* Output: {key1: key1, key2: key2}
|
|
31
|
-
*
|
|
32
|
-
* @param {object} obj
|
|
33
|
-
* @return {object}
|
|
34
|
-
*/
|
|
35
|
-
var keyMirror = function (obj) {
|
|
36
|
-
var ret = {};
|
|
37
|
-
var key;
|
|
38
|
-
!(obj instanceof Object && !Array.isArray(obj)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
|
|
39
|
-
for (key in obj) {
|
|
40
|
-
if (!obj.hasOwnProperty(key)) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
ret[key] = key;
|
|
44
|
-
}
|
|
45
|
-
return ret;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
module.exports = keyMirror;
|
package/lib/keyOf.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-2015, 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 keyOf
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Allows extraction of a minified key. Let's the build system minify keys
|
|
14
|
-
* without loosing the ability to dynamically use key strings as values
|
|
15
|
-
* themselves. Pass in an object with a single key/val pair and it will return
|
|
16
|
-
* you the string key of that single record. Suppose you want to grab the
|
|
17
|
-
* value for a key 'className' inside of an object. Key/val minification may
|
|
18
|
-
* have aliased that key to be 'xa12'. keyOf({className: null}) will return
|
|
19
|
-
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
|
|
20
|
-
* reuse those resolutions.
|
|
21
|
-
*/
|
|
22
|
-
"use strict";
|
|
23
|
-
|
|
24
|
-
var keyOf = function (oneKeyObj) {
|
|
25
|
-
var key;
|
|
26
|
-
for (key in oneKeyObj) {
|
|
27
|
-
if (!oneKeyObj.hasOwnProperty(key)) {
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
return key;
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
module.exports = keyOf;
|
package/lib/mapObject.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-2015, 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 mapObject
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Executes the provided `callback` once for each enumerable own property in the
|
|
18
|
-
* object and constructs a new object from the results. The `callback` is
|
|
19
|
-
* invoked with three arguments:
|
|
20
|
-
*
|
|
21
|
-
* - the property value
|
|
22
|
-
* - the property name
|
|
23
|
-
* - the object being traversed
|
|
24
|
-
*
|
|
25
|
-
* Properties that are added after the call to `mapObject` will not be visited
|
|
26
|
-
* by `callback`. If the values of existing properties are changed, the value
|
|
27
|
-
* passed to `callback` will be the value at the time `mapObject` visits them.
|
|
28
|
-
* Properties that are deleted before being visited are not visited.
|
|
29
|
-
*
|
|
30
|
-
* @grep function objectMap()
|
|
31
|
-
* @grep function objMap()
|
|
32
|
-
*
|
|
33
|
-
* @param {?object} object
|
|
34
|
-
* @param {function} callback
|
|
35
|
-
* @param {*} context
|
|
36
|
-
* @return {?object}
|
|
37
|
-
*/
|
|
38
|
-
function mapObject(object, callback, context) {
|
|
39
|
-
if (!object) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
var result = {};
|
|
43
|
-
for (var name in object) {
|
|
44
|
-
if (hasOwnProperty.call(object, name)) {
|
|
45
|
-
result[name] = callback.call(context, object[name], name, object);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
module.exports = mapObject;
|
package/lib/memoizeStringOnly.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-2015, 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 memoizeStringOnly
|
|
10
|
-
* @typechecks static-only
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Memoizes the return value of a function that accepts one string argument.
|
|
17
|
-
*
|
|
18
|
-
* @param {function} callback
|
|
19
|
-
* @return {function}
|
|
20
|
-
*/
|
|
21
|
-
function memoizeStringOnly(callback) {
|
|
22
|
-
var cache = {};
|
|
23
|
-
return function (string) {
|
|
24
|
-
if (!cache.hasOwnProperty(string)) {
|
|
25
|
-
cache[string] = callback.call(this, string);
|
|
26
|
-
}
|
|
27
|
-
return cache[string];
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
module.exports = memoizeStringOnly;
|
package/lib/performanceNow.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-2015, 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 performanceNow
|
|
10
|
-
* @typechecks
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
var performance = require("./performance");
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Detect if we can use `window.performance.now()` and gracefully fallback to
|
|
19
|
-
* `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
|
|
20
|
-
* because of Facebook's testing infrastructure.
|
|
21
|
-
*/
|
|
22
|
-
if (!performance || !performance.now) {
|
|
23
|
-
performance = Date;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
var performanceNow = performance.now.bind(performance);
|
|
27
|
-
|
|
28
|
-
module.exports = performanceNow;
|
package/lib/shallowEqual.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-2015, 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 shallowEqual
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Performs equality by iterating through keys on an object and returning
|
|
16
|
-
* false when any key has values which are not strictly equal between
|
|
17
|
-
* objA and objB. Returns true when the values of all keys are strictly equal.
|
|
18
|
-
*
|
|
19
|
-
* @return {boolean}
|
|
20
|
-
*/
|
|
21
|
-
function shallowEqual(objA, objB) {
|
|
22
|
-
if (objA === objB) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var keysA = Object.keys(objA);
|
|
31
|
-
var keysB = Object.keys(objB);
|
|
32
|
-
|
|
33
|
-
if (keysA.length !== keysB.length) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Test for A's keys different from B.
|
|
38
|
-
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
|
39
|
-
for (var i = 0; i < keysA.length; i++) {
|
|
40
|
-
if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
module.exports = shallowEqual;
|
package/lib/toArray.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2014-2015, 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 toArray
|
|
10
|
-
* @typechecks
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
var invariant = require("./invariant");
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Convert array-like objects to arrays.
|
|
19
|
-
*
|
|
20
|
-
* This API assumes the caller knows the contents of the data type. For less
|
|
21
|
-
* well defined inputs use createArrayFromMixed.
|
|
22
|
-
*
|
|
23
|
-
* @param {object|function|filelist} obj
|
|
24
|
-
* @return {array}
|
|
25
|
-
*/
|
|
26
|
-
function toArray(obj) {
|
|
27
|
-
var length = obj.length;
|
|
28
|
-
|
|
29
|
-
// Some browse builtin objects can report typeof 'function' (e.g. NodeList in
|
|
30
|
-
// old versions of Safari).
|
|
31
|
-
!(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
|
|
32
|
-
|
|
33
|
-
!(typeof length === 'number') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
|
|
34
|
-
|
|
35
|
-
!(length === 0 || length - 1 in obj) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
|
|
36
|
-
|
|
37
|
-
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs
|
|
38
|
-
// without method will throw during the slice call and skip straight to the
|
|
39
|
-
// fallback.
|
|
40
|
-
if (obj.hasOwnProperty) {
|
|
41
|
-
try {
|
|
42
|
-
return Array.prototype.slice.call(obj);
|
|
43
|
-
} catch (e) {}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Fall back to copying key by key. This assumes all keys have a value,
|
|
47
|
-
// so will not preserve sparsely populated inputs.
|
|
48
|
-
var ret = Array(length);
|
|
49
|
-
for (var ii = 0; ii < length; ii++) {
|
|
50
|
-
ret[ii] = obj[ii];
|
|
51
|
-
}
|
|
52
|
-
return ret;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
module.exports = toArray;
|
|
56
|
-
|
|
57
|
-
// IE < 9 does not support Array#slice on collections objects
|
package/lib/warning.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2014-2015, 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 warning
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var emptyFunction = require("./emptyFunction");
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
18
|
-
* This can be used to log issues in development environments in critical
|
|
19
|
-
* paths. Removing the logging code for production environments will keep the
|
|
20
|
-
* same logic and follow the same code paths.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
var warning = emptyFunction;
|
|
24
|
-
|
|
25
|
-
if ('production' !== process.env.NODE_ENV) {
|
|
26
|
-
warning = function (condition, format) {
|
|
27
|
-
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
28
|
-
args[_key - 2] = arguments[_key];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (format === undefined) {
|
|
32
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
|
36
|
-
return; // Ignore CompositeComponent proptype check.
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (!condition) {
|
|
40
|
-
var argIndex = 0;
|
|
41
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
42
|
-
return args[argIndex++];
|
|
43
|
-
});
|
|
44
|
-
if (typeof console !== 'undefined') {
|
|
45
|
-
console.error(message);
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
// --- Welcome to debugging React ---
|
|
49
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
50
|
-
// to find the callsite that caused this warning to fire.
|
|
51
|
-
throw new Error(message);
|
|
52
|
-
} catch (x) {}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
module.exports = warning;
|