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 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | 'use strict';
|
10 |
|
11 | var printWarning = function() {};
|
12 |
|
13 | if ("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 |
|
24 |
|
25 |
|
26 | throw new Error(message);
|
27 | } catch (x) {}
|
28 | };
|
29 | }
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | function 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 |
|
48 |
|
49 |
|
50 | try {
|
51 |
|
52 |
|
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 |
|
78 |
|
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 |
|
92 | module.exports = checkPropTypes;
|
93 |
|
94 | },{"./lib/ReactPropTypesSecret":5}],2:[function(require,module,exports){
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | 'use strict';
|
103 |
|
104 | var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
|
105 |
|
106 | function emptyFunction() {}
|
107 |
|
108 | module.exports = function() {
|
109 | function shim(props, propName, componentName, location, propFullName, secret) {
|
110 | if (secret === ReactPropTypesSecret) {
|
111 |
|
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 |
|
127 |
|
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 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | 'use strict';
|
164 |
|
165 | var assign = require('object-assign');
|
166 |
|
167 | var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
|
168 | var checkPropTypes = require('./checkPropTypes');
|
169 |
|
170 | var printWarning = function() {};
|
171 |
|
172 | if ("development" !== 'production') {
|
173 | printWarning = function(text) {
|
174 | var message = 'Warning: ' + text;
|
175 | if (typeof console !== 'undefined') {
|
176 | console.error(message);
|
177 | }
|
178 | try {
|
179 |
|
180 |
|
181 |
|
182 | throw new Error(message);
|
183 | } catch (x) {}
|
184 | };
|
185 | }
|
186 |
|
187 | function emptyFunctionThatReturnsNull() {
|
188 | return null;
|
189 | }
|
190 |
|
191 | module.exports = function(isValidElement, throwOnDirectAccess) {
|
192 |
|
193 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
194 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
195 |
|
196 | |
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
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 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 | var ANONYMOUS = '<<anonymous>>';
|
265 |
|
266 |
|
267 |
|
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 |
|
291 |
|
292 |
|
293 |
|
294 | function is(x, y) {
|
295 |
|
296 | if (x === y) {
|
297 |
|
298 |
|
299 | return x !== 0 || 1 / x === 1 / y;
|
300 | } else {
|
301 |
|
302 | return x !== x && y !== y;
|
303 | }
|
304 | }
|
305 |
|
306 |
|
307 | |
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 | function PropTypeError(message) {
|
315 | this.message = message;
|
316 | this.stack = '';
|
317 | }
|
318 |
|
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 |
|
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 |
|
342 | var cacheKey = componentName + ':' + propName;
|
343 | if (
|
344 | !manualPropTypeCallCache[cacheKey] &&
|
345 |
|
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 |
|
385 |
|
386 |
|
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 |
|
558 |
|
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 |
|
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 |
|
629 | if (propType === 'symbol') {
|
630 | return true;
|
631 | }
|
632 |
|
633 |
|
634 | if (propValue['@@toStringTag'] === 'Symbol') {
|
635 | return true;
|
636 | }
|
637 |
|
638 |
|
639 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
640 | return true;
|
641 | }
|
642 |
|
643 | return false;
|
644 | }
|
645 |
|
646 |
|
647 | function getPropType(propValue) {
|
648 | var propType = typeof propValue;
|
649 | if (Array.isArray(propValue)) {
|
650 | return 'array';
|
651 | }
|
652 | if (propValue instanceof RegExp) {
|
653 |
|
654 |
|
655 |
|
656 | return 'object';
|
657 | }
|
658 | if (isSymbol(propType, propValue)) {
|
659 | return 'symbol';
|
660 | }
|
661 | return propType;
|
662 | }
|
663 |
|
664 |
|
665 |
|
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 |
|
682 |
|
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 |
|
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 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 | if ("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 |
|
733 |
|
734 | var throwOnDirectAccess = true;
|
735 | module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);
|
736 | } else {
|
737 |
|
738 |
|
739 | module.exports = require('./factoryWithThrowingShims')();
|
740 | }
|
741 |
|
742 | },{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3}],5:[function(require,module,exports){
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 | 'use strict';
|
751 |
|
752 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
753 |
|
754 | module.exports = ReactPropTypesSecret;
|
755 |
|
756 | },{}],6:[function(require,module,exports){
|
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 | 'use strict';
|
764 |
|
765 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
766 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
767 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
768 |
|
769 | function 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 |
|
777 | function shouldUseNative() {
|
778 | try {
|
779 | if (!Object.assign) {
|
780 | return false;
|
781 | }
|
782 |
|
783 |
|
784 |
|
785 |
|
786 | var test1 = new String('abc');
|
787 | test1[5] = 'de';
|
788 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
789 | return false;
|
790 | }
|
791 |
|
792 |
|
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 |
|
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 |
|
817 | return false;
|
818 | }
|
819 | }
|
820 |
|
821 | module.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 |