UNPKG

29.8 kBJavaScriptView Raw
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.PropTypes = 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 * Copyright (c) 2013-present, Facebook, Inc.
4 *
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9'use strict';
10
11var printWarning = function() {};
12
13if ("development" !== 'production') {
14 var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
15 var loggedTypeFailures = {};
16
17 printWarning = function(text) {
18 var message = 'Warning: ' + text;
19 if (typeof console !== 'undefined') {
20 console.error(message);
21 }
22 try {
23 // --- Welcome to debugging React ---
24 // This error was thrown as a convenience so that you can use this stack
25 // to find the callsite that caused this warning to fire.
26 throw new Error(message);
27 } catch (x) {}
28 };
29}
30
31/**
32 * Assert that the values match with the type specs.
33 * Error messages are memorized and will only be shown once.
34 *
35 * @param {object} typeSpecs Map of name to a ReactPropType
36 * @param {object} values Runtime values that need to be type-checked
37 * @param {string} location e.g. "prop", "context", "child context"
38 * @param {string} componentName Name of the component for error messages.
39 * @param {?Function} getStack Returns the component stack.
40 * @private
41 */
42function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
43 if ("development" !== 'production') {
44 for (var typeSpecName in typeSpecs) {
45 if (typeSpecs.hasOwnProperty(typeSpecName)) {
46 var error;
47 // Prop type validation may throw. In case they do, we don't want to
48 // fail the render phase where it didn't fail before. So we log it.
49 // After these have been cleaned up, we'll let them throw.
50 try {
51 // This is intentionally an invariant that gets caught. It's the same
52 // behavior as without this statement except with a better message.
53 if (typeof typeSpecs[typeSpecName] !== 'function') {
54 var err = Error(
55 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
56 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
57 );
58 err.name = 'Invariant Violation';
59 throw err;
60 }
61 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
62 } catch (ex) {
63 error = ex;
64 }
65 if (error && !(error instanceof Error)) {
66 printWarning(
67 (componentName || 'React class') + ': type specification of ' +
68 location + ' `' + typeSpecName + '` is invalid; the type checker ' +
69 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
70 'You may have forgotten to pass an argument to the type checker ' +
71 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
72 'shape all require an argument).'
73 )
74
75 }
76 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
77 // Only monitor this failure once because there tends to be a lot of the
78 // same error.
79 loggedTypeFailures[error.message] = true;
80
81 var stack = getStack ? getStack() : '';
82
83 printWarning(
84 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
85 );
86 }
87 }
88 }
89 }
90}
91
92module.exports = checkPropTypes;
93
94},{"./lib/ReactPropTypesSecret":5}],2:[function(require,module,exports){
95/**
96 * Copyright (c) 2013-present, Facebook, Inc.
97 *
98 * This source code is licensed under the MIT license found in the
99 * LICENSE file in the root directory of this source tree.
100 */
101
102'use strict';
103
104var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
105
106function emptyFunction() {}
107
108module.exports = function() {
109 function shim(props, propName, componentName, location, propFullName, secret) {
110 if (secret === ReactPropTypesSecret) {
111 // It is still safe when called from React.
112 return;
113 }
114 var err = new Error(
115 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
116 'Use PropTypes.checkPropTypes() to call them. ' +
117 'Read more at http://fb.me/use-check-prop-types'
118 );
119 err.name = 'Invariant Violation';
120 throw err;
121 };
122 shim.isRequired = shim;
123 function getShim() {
124 return shim;
125 };
126 // Important!
127 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
128 var ReactPropTypes = {
129 array: shim,
130 bool: shim,
131 func: shim,
132 number: shim,
133 object: shim,
134 string: shim,
135 symbol: shim,
136
137 any: shim,
138 arrayOf: getShim,
139 element: shim,
140 instanceOf: getShim,
141 node: shim,
142 objectOf: getShim,
143 oneOf: getShim,
144 oneOfType: getShim,
145 shape: getShim,
146 exact: getShim
147 };
148
149 ReactPropTypes.checkPropTypes = emptyFunction;
150 ReactPropTypes.PropTypes = ReactPropTypes;
151
152 return ReactPropTypes;
153};
154
155},{"./lib/ReactPropTypesSecret":5}],3:[function(require,module,exports){
156/**
157 * Copyright (c) 2013-present, Facebook, Inc.
158 *
159 * This source code is licensed under the MIT license found in the
160 * LICENSE file in the root directory of this source tree.
161 */
162
163'use strict';
164
165var assign = require('object-assign');
166
167var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
168var checkPropTypes = require('./checkPropTypes');
169
170var printWarning = function() {};
171
172if ("development" !== 'production') {
173 printWarning = function(text) {
174 var message = 'Warning: ' + text;
175 if (typeof console !== 'undefined') {
176 console.error(message);
177 }
178 try {
179 // --- Welcome to debugging React ---
180 // This error was thrown as a convenience so that you can use this stack
181 // to find the callsite that caused this warning to fire.
182 throw new Error(message);
183 } catch (x) {}
184 };
185}
186
187function emptyFunctionThatReturnsNull() {
188 return null;
189}
190
191module.exports = function(isValidElement, throwOnDirectAccess) {
192 /* global Symbol */
193 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
194 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
195
196 /**
197 * Returns the iterator method function contained on the iterable object.
198 *
199 * Be sure to invoke the function with the iterable as context:
200 *
201 * var iteratorFn = getIteratorFn(myIterable);
202 * if (iteratorFn) {
203 * var iterator = iteratorFn.call(myIterable);
204 * ...
205 * }
206 *
207 * @param {?object} maybeIterable
208 * @return {?function}
209 */
210 function getIteratorFn(maybeIterable) {
211 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
212 if (typeof iteratorFn === 'function') {
213 return iteratorFn;
214 }
215 }
216
217 /**
218 * Collection of methods that allow declaration and validation of props that are
219 * supplied to React components. Example usage:
220 *
221 * var Props = require('ReactPropTypes');
222 * var MyArticle = React.createClass({
223 * propTypes: {
224 * // An optional string prop named "description".
225 * description: Props.string,
226 *
227 * // A required enum prop named "category".
228 * category: Props.oneOf(['News','Photos']).isRequired,
229 *
230 * // A prop named "dialog" that requires an instance of Dialog.
231 * dialog: Props.instanceOf(Dialog).isRequired
232 * },
233 * render: function() { ... }
234 * });
235 *
236 * A more formal specification of how these methods are used:
237 *
238 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
239 * decl := ReactPropTypes.{type}(.isRequired)?
240 *
241 * Each and every declaration produces a function with the same signature. This
242 * allows the creation of custom validation functions. For example:
243 *
244 * var MyLink = React.createClass({
245 * propTypes: {
246 * // An optional string or URI prop named "href".
247 * href: function(props, propName, componentName) {
248 * var propValue = props[propName];
249 * if (propValue != null && typeof propValue !== 'string' &&
250 * !(propValue instanceof URI)) {
251 * return new Error(
252 * 'Expected a string or an URI for ' + propName + ' in ' +
253 * componentName
254 * );
255 * }
256 * }
257 * },
258 * render: function() {...}
259 * });
260 *
261 * @internal
262 */
263
264 var ANONYMOUS = '<<anonymous>>';
265
266 // Important!
267 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
268 var ReactPropTypes = {
269 array: createPrimitiveTypeChecker('array'),
270 bool: createPrimitiveTypeChecker('boolean'),
271 func: createPrimitiveTypeChecker('function'),
272 number: createPrimitiveTypeChecker('number'),
273 object: createPrimitiveTypeChecker('object'),
274 string: createPrimitiveTypeChecker('string'),
275 symbol: createPrimitiveTypeChecker('symbol'),
276
277 any: createAnyTypeChecker(),
278 arrayOf: createArrayOfTypeChecker,
279 element: createElementTypeChecker(),
280 instanceOf: createInstanceTypeChecker,
281 node: createNodeChecker(),
282 objectOf: createObjectOfTypeChecker,
283 oneOf: createEnumTypeChecker,
284 oneOfType: createUnionTypeChecker,
285 shape: createShapeTypeChecker,
286 exact: createStrictShapeTypeChecker,
287 };
288
289 /**
290 * inlined Object.is polyfill to avoid requiring consumers ship their own
291 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
292 */
293 /*eslint-disable no-self-compare*/
294 function is(x, y) {
295 // SameValue algorithm
296 if (x === y) {
297 // Steps 1-5, 7-10
298 // Steps 6.b-6.e: +0 != -0
299 return x !== 0 || 1 / x === 1 / y;
300 } else {
301 // Step 6.a: NaN == NaN
302 return x !== x && y !== y;
303 }
304 }
305 /*eslint-enable no-self-compare*/
306
307 /**
308 * We use an Error-like object for backward compatibility as people may call
309 * PropTypes directly and inspect their output. However, we don't use real
310 * Errors anymore. We don't inspect their stack anyway, and creating them
311 * is prohibitively expensive if they are created too often, such as what
312 * happens in oneOfType() for any type before the one that matched.
313 */
314 function PropTypeError(message) {
315 this.message = message;
316 this.stack = '';
317 }
318 // Make `instanceof Error` still work for returned errors.
319 PropTypeError.prototype = Error.prototype;
320
321 function createChainableTypeChecker(validate) {
322 if ("development" !== 'production') {
323 var manualPropTypeCallCache = {};
324 var manualPropTypeWarningCount = 0;
325 }
326 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
327 componentName = componentName || ANONYMOUS;
328 propFullName = propFullName || propName;
329
330 if (secret !== ReactPropTypesSecret) {
331 if (throwOnDirectAccess) {
332 // New behavior only for users of `prop-types` package
333 var err = new Error(
334 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
335 'Use `PropTypes.checkPropTypes()` to call them. ' +
336 'Read more at http://fb.me/use-check-prop-types'
337 );
338 err.name = 'Invariant Violation';
339 throw err;
340 } else if ("development" !== 'production' && typeof console !== 'undefined') {
341 // Old behavior for people using React.PropTypes
342 var cacheKey = componentName + ':' + propName;
343 if (
344 !manualPropTypeCallCache[cacheKey] &&
345 // Avoid spamming the console because they are often not actionable except for lib authors
346 manualPropTypeWarningCount < 3
347 ) {
348 printWarning(
349 'You are manually calling a React.PropTypes validation ' +
350 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
351 'and will throw in the standalone `prop-types` package. ' +
352 'You may be seeing this warning due to a third-party PropTypes ' +
353 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
354 );
355 manualPropTypeCallCache[cacheKey] = true;
356 manualPropTypeWarningCount++;
357 }
358 }
359 }
360 if (props[propName] == null) {
361 if (isRequired) {
362 if (props[propName] === null) {
363 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
364 }
365 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
366 }
367 return null;
368 } else {
369 return validate(props, propName, componentName, location, propFullName);
370 }
371 }
372
373 var chainedCheckType = checkType.bind(null, false);
374 chainedCheckType.isRequired = checkType.bind(null, true);
375
376 return chainedCheckType;
377 }
378
379 function createPrimitiveTypeChecker(expectedType) {
380 function validate(props, propName, componentName, location, propFullName, secret) {
381 var propValue = props[propName];
382 var propType = getPropType(propValue);
383 if (propType !== expectedType) {
384 // `propValue` being instance of, say, date/regexp, pass the 'object'
385 // check, but we can offer a more precise error message here rather than
386 // 'of type `object`'.
387 var preciseType = getPreciseType(propValue);
388
389 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
390 }
391 return null;
392 }
393 return createChainableTypeChecker(validate);
394 }
395
396 function createAnyTypeChecker() {
397 return createChainableTypeChecker(emptyFunctionThatReturnsNull);
398 }
399
400 function createArrayOfTypeChecker(typeChecker) {
401 function validate(props, propName, componentName, location, propFullName) {
402 if (typeof typeChecker !== 'function') {
403 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
404 }
405 var propValue = props[propName];
406 if (!Array.isArray(propValue)) {
407 var propType = getPropType(propValue);
408 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
409 }
410 for (var i = 0; i < propValue.length; i++) {
411 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
412 if (error instanceof Error) {
413 return error;
414 }
415 }
416 return null;
417 }
418 return createChainableTypeChecker(validate);
419 }
420
421 function createElementTypeChecker() {
422 function validate(props, propName, componentName, location, propFullName) {
423 var propValue = props[propName];
424 if (!isValidElement(propValue)) {
425 var propType = getPropType(propValue);
426 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
427 }
428 return null;
429 }
430 return createChainableTypeChecker(validate);
431 }
432
433 function createInstanceTypeChecker(expectedClass) {
434 function validate(props, propName, componentName, location, propFullName) {
435 if (!(props[propName] instanceof expectedClass)) {
436 var expectedClassName = expectedClass.name || ANONYMOUS;
437 var actualClassName = getClassName(props[propName]);
438 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
439 }
440 return null;
441 }
442 return createChainableTypeChecker(validate);
443 }
444
445 function createEnumTypeChecker(expectedValues) {
446 if (!Array.isArray(expectedValues)) {
447 "development" !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
448 return emptyFunctionThatReturnsNull;
449 }
450
451 function validate(props, propName, componentName, location, propFullName) {
452 var propValue = props[propName];
453 for (var i = 0; i < expectedValues.length; i++) {
454 if (is(propValue, expectedValues[i])) {
455 return null;
456 }
457 }
458
459 var valuesString = JSON.stringify(expectedValues);
460 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
461 }
462 return createChainableTypeChecker(validate);
463 }
464
465 function createObjectOfTypeChecker(typeChecker) {
466 function validate(props, propName, componentName, location, propFullName) {
467 if (typeof typeChecker !== 'function') {
468 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
469 }
470 var propValue = props[propName];
471 var propType = getPropType(propValue);
472 if (propType !== 'object') {
473 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
474 }
475 for (var key in propValue) {
476 if (propValue.hasOwnProperty(key)) {
477 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
478 if (error instanceof Error) {
479 return error;
480 }
481 }
482 }
483 return null;
484 }
485 return createChainableTypeChecker(validate);
486 }
487
488 function createUnionTypeChecker(arrayOfTypeCheckers) {
489 if (!Array.isArray(arrayOfTypeCheckers)) {
490 "development" !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
491 return emptyFunctionThatReturnsNull;
492 }
493
494 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
495 var checker = arrayOfTypeCheckers[i];
496 if (typeof checker !== 'function') {
497 printWarning(
498 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
499 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
500 );
501 return emptyFunctionThatReturnsNull;
502 }
503 }
504
505 function validate(props, propName, componentName, location, propFullName) {
506 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
507 var checker = arrayOfTypeCheckers[i];
508 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
509 return null;
510 }
511 }
512
513 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
514 }
515 return createChainableTypeChecker(validate);
516 }
517
518 function createNodeChecker() {
519 function validate(props, propName, componentName, location, propFullName) {
520 if (!isNode(props[propName])) {
521 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
522 }
523 return null;
524 }
525 return createChainableTypeChecker(validate);
526 }
527
528 function createShapeTypeChecker(shapeTypes) {
529 function validate(props, propName, componentName, location, propFullName) {
530 var propValue = props[propName];
531 var propType = getPropType(propValue);
532 if (propType !== 'object') {
533 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
534 }
535 for (var key in shapeTypes) {
536 var checker = shapeTypes[key];
537 if (!checker) {
538 continue;
539 }
540 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
541 if (error) {
542 return error;
543 }
544 }
545 return null;
546 }
547 return createChainableTypeChecker(validate);
548 }
549
550 function createStrictShapeTypeChecker(shapeTypes) {
551 function validate(props, propName, componentName, location, propFullName) {
552 var propValue = props[propName];
553 var propType = getPropType(propValue);
554 if (propType !== 'object') {
555 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
556 }
557 // We need to check all keys in case some are required but missing from
558 // props.
559 var allKeys = assign({}, props[propName], shapeTypes);
560 for (var key in allKeys) {
561 var checker = shapeTypes[key];
562 if (!checker) {
563 return new PropTypeError(
564 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
565 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
566 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
567 );
568 }
569 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
570 if (error) {
571 return error;
572 }
573 }
574 return null;
575 }
576
577 return createChainableTypeChecker(validate);
578 }
579
580 function isNode(propValue) {
581 switch (typeof propValue) {
582 case 'number':
583 case 'string':
584 case 'undefined':
585 return true;
586 case 'boolean':
587 return !propValue;
588 case 'object':
589 if (Array.isArray(propValue)) {
590 return propValue.every(isNode);
591 }
592 if (propValue === null || isValidElement(propValue)) {
593 return true;
594 }
595
596 var iteratorFn = getIteratorFn(propValue);
597 if (iteratorFn) {
598 var iterator = iteratorFn.call(propValue);
599 var step;
600 if (iteratorFn !== propValue.entries) {
601 while (!(step = iterator.next()).done) {
602 if (!isNode(step.value)) {
603 return false;
604 }
605 }
606 } else {
607 // Iterator will provide entry [k,v] tuples rather than values.
608 while (!(step = iterator.next()).done) {
609 var entry = step.value;
610 if (entry) {
611 if (!isNode(entry[1])) {
612 return false;
613 }
614 }
615 }
616 }
617 } else {
618 return false;
619 }
620
621 return true;
622 default:
623 return false;
624 }
625 }
626
627 function isSymbol(propType, propValue) {
628 // Native Symbol.
629 if (propType === 'symbol') {
630 return true;
631 }
632
633 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
634 if (propValue['@@toStringTag'] === 'Symbol') {
635 return true;
636 }
637
638 // Fallback for non-spec compliant Symbols which are polyfilled.
639 if (typeof Symbol === 'function' && propValue instanceof Symbol) {
640 return true;
641 }
642
643 return false;
644 }
645
646 // Equivalent of `typeof` but with special handling for array and regexp.
647 function getPropType(propValue) {
648 var propType = typeof propValue;
649 if (Array.isArray(propValue)) {
650 return 'array';
651 }
652 if (propValue instanceof RegExp) {
653 // Old webkits (at least until Android 4.0) return 'function' rather than
654 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
655 // passes PropTypes.object.
656 return 'object';
657 }
658 if (isSymbol(propType, propValue)) {
659 return 'symbol';
660 }
661 return propType;
662 }
663
664 // This handles more types than `getPropType`. Only used for error messages.
665 // See `createPrimitiveTypeChecker`.
666 function getPreciseType(propValue) {
667 if (typeof propValue === 'undefined' || propValue === null) {
668 return '' + propValue;
669 }
670 var propType = getPropType(propValue);
671 if (propType === 'object') {
672 if (propValue instanceof Date) {
673 return 'date';
674 } else if (propValue instanceof RegExp) {
675 return 'regexp';
676 }
677 }
678 return propType;
679 }
680
681 // Returns a string that is postfixed to a warning about an invalid type.
682 // For example, "undefined" or "of type array"
683 function getPostfixForTypeWarning(value) {
684 var type = getPreciseType(value);
685 switch (type) {
686 case 'array':
687 case 'object':
688 return 'an ' + type;
689 case 'boolean':
690 case 'date':
691 case 'regexp':
692 return 'a ' + type;
693 default:
694 return type;
695 }
696 }
697
698 // Returns class name of the object, if any.
699 function getClassName(propValue) {
700 if (!propValue.constructor || !propValue.constructor.name) {
701 return ANONYMOUS;
702 }
703 return propValue.constructor.name;
704 }
705
706 ReactPropTypes.checkPropTypes = checkPropTypes;
707 ReactPropTypes.PropTypes = ReactPropTypes;
708
709 return ReactPropTypes;
710};
711
712},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"object-assign":6}],4:[function(require,module,exports){
713/**
714 * Copyright (c) 2013-present, Facebook, Inc.
715 *
716 * This source code is licensed under the MIT license found in the
717 * LICENSE file in the root directory of this source tree.
718 */
719
720if ("development" !== 'production') {
721 var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
722 Symbol.for &&
723 Symbol.for('react.element')) ||
724 0xeac7;
725
726 var isValidElement = function(object) {
727 return typeof object === 'object' &&
728 object !== null &&
729 object.$$typeof === REACT_ELEMENT_TYPE;
730 };
731
732 // By explicitly using `prop-types` you are opting into new development behavior.
733 // http://fb.me/prop-types-in-prod
734 var throwOnDirectAccess = true;
735 module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);
736} else {
737 // By explicitly using `prop-types` you are opting into new production behavior.
738 // http://fb.me/prop-types-in-prod
739 module.exports = require('./factoryWithThrowingShims')();
740}
741
742},{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3}],5:[function(require,module,exports){
743/**
744 * Copyright (c) 2013-present, Facebook, Inc.
745 *
746 * This source code is licensed under the MIT license found in the
747 * LICENSE file in the root directory of this source tree.
748 */
749
750'use strict';
751
752var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
753
754module.exports = ReactPropTypesSecret;
755
756},{}],6:[function(require,module,exports){
757/*
758object-assign
759(c) Sindre Sorhus
760@license MIT
761*/
762
763'use strict';
764/* eslint-disable no-unused-vars */
765var getOwnPropertySymbols = Object.getOwnPropertySymbols;
766var hasOwnProperty = Object.prototype.hasOwnProperty;
767var propIsEnumerable = Object.prototype.propertyIsEnumerable;
768
769function toObject(val) {
770 if (val === null || val === undefined) {
771 throw new TypeError('Object.assign cannot be called with null or undefined');
772 }
773
774 return Object(val);
775}
776
777function shouldUseNative() {
778 try {
779 if (!Object.assign) {
780 return false;
781 }
782
783 // Detect buggy property enumeration order in older V8 versions.
784
785 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
786 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
787 test1[5] = 'de';
788 if (Object.getOwnPropertyNames(test1)[0] === '5') {
789 return false;
790 }
791
792 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
793 var test2 = {};
794 for (var i = 0; i < 10; i++) {
795 test2['_' + String.fromCharCode(i)] = i;
796 }
797 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
798 return test2[n];
799 });
800 if (order2.join('') !== '0123456789') {
801 return false;
802 }
803
804 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
805 var test3 = {};
806 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
807 test3[letter] = letter;
808 });
809 if (Object.keys(Object.assign({}, test3)).join('') !==
810 'abcdefghijklmnopqrst') {
811 return false;
812 }
813
814 return true;
815 } catch (err) {
816 // We don't expect any of the above to throw, but better to be safe.
817 return false;
818 }
819}
820
821module.exports = shouldUseNative() ? Object.assign : function (target, source) {
822 var from;
823 var to = toObject(target);
824 var symbols;
825
826 for (var s = 1; s < arguments.length; s++) {
827 from = Object(arguments[s]);
828
829 for (var key in from) {
830 if (hasOwnProperty.call(from, key)) {
831 to[key] = from[key];
832 }
833 }
834
835 if (getOwnPropertySymbols) {
836 symbols = getOwnPropertySymbols(from);
837 for (var i = 0; i < symbols.length; i++) {
838 if (propIsEnumerable.call(from, symbols[i])) {
839 to[symbols[i]] = from[symbols[i]];
840 }
841 }
842 }
843 }
844
845 return to;
846};
847
848},{}]},{},[4])(4)
849});
\No newline at end of file