* Ensure that every element either is passed in a static location, in an * array with an explicit keys property defined, or in an object literal * with valid key property. * * @internal * @param {ReactNode} node Statically passed child of any type. * @param {*} parentType node's parent's type.
(node, parentType)
| 18820 | * @param {*} parentType node's parent's type. |
| 18821 | */ |
| 18822 | function validateChildKeys(node, parentType) { |
| 18823 | if (typeof node !== 'object') { |
| 18824 | return; |
| 18825 | } |
| 18826 | if (Array.isArray(node)) { |
| 18827 | for (var i = 0; i < node.length; i++) { |
| 18828 | var child = node[i]; |
| 18829 | if (isValidElement(child)) { |
| 18830 | validateExplicitKey(child, parentType); |
| 18831 | } |
| 18832 | } |
| 18833 | } else if (isValidElement(node)) { |
| 18834 | // This element was passed in a valid location. |
| 18835 | if (node._store) { |
| 18836 | node._store.validated = true; |
| 18837 | } |
| 18838 | } else if (node) { |
| 18839 | var iteratorFn = getIteratorFn(node); |
| 18840 | if (typeof iteratorFn === 'function') { |
| 18841 | // Entry iterators used to provide implicit keys, |
| 18842 | // but now we print a separate warning for them later. |
| 18843 | if (iteratorFn !== node.entries) { |
| 18844 | var iterator = iteratorFn.call(node); |
| 18845 | var step = void 0; |
| 18846 | while (!(step = iterator.next()).done) { |
| 18847 | if (isValidElement(step.value)) { |
| 18848 | validateExplicitKey(step.value, parentType); |
| 18849 | } |
| 18850 | } |
| 18851 | } |
| 18852 | } |
| 18853 | } |
| 18854 | } |
| 18855 | |
| 18856 | /** |
| 18857 | * Given an element, validate that its props follow the propTypes definition, |
no test coverage detected