(propValue)
| 12689 | } |
| 12690 | |
| 12691 | function isNode(propValue) { |
| 12692 | switch (typeof propValue) { |
| 12693 | case 'number': |
| 12694 | case 'string': |
| 12695 | case 'undefined': |
| 12696 | return true; |
| 12697 | case 'boolean': |
| 12698 | return !propValue; |
| 12699 | case 'object': |
| 12700 | if (Array.isArray(propValue)) { |
| 12701 | return propValue.every(isNode); |
| 12702 | } |
| 12703 | if (propValue === null || ReactElement.isValidElement(propValue)) { |
| 12704 | return true; |
| 12705 | } |
| 12706 | |
| 12707 | var iteratorFn = getIteratorFn(propValue); |
| 12708 | if (iteratorFn) { |
| 12709 | var iterator = iteratorFn.call(propValue); |
| 12710 | var step; |
| 12711 | if (iteratorFn !== propValue.entries) { |
| 12712 | while (!(step = iterator.next()).done) { |
| 12713 | if (!isNode(step.value)) { |
| 12714 | return false; |
| 12715 | } |
| 12716 | } |
| 12717 | } else { |
| 12718 | // Iterator will provide entry [k,v] tuples rather than values. |
| 12719 | while (!(step = iterator.next()).done) { |
| 12720 | var entry = step.value; |
| 12721 | if (entry) { |
| 12722 | if (!isNode(entry[1])) { |
| 12723 | return false; |
| 12724 | } |
| 12725 | } |
| 12726 | } |
| 12727 | } |
| 12728 | } else { |
| 12729 | return false; |
| 12730 | } |
| 12731 | |
| 12732 | return true; |
| 12733 | default: |
| 12734 | return false; |
| 12735 | } |
| 12736 | } |
| 12737 | |
| 12738 | // Equivalent of `typeof` but with special handling for array and regexp. |
| 12739 | function getPropType(propValue) { |
no test coverage detected