* 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)
| 20840 | * @param {*} parentType node's parent's type. |
| 20841 | */ |
| 20842 | function validateChildKeys(node, parentType) { |
| 20843 | if (typeof node !== 'object') { |
| 20844 | return; |
| 20845 | } |
| 20846 | if (Array.isArray(node)) { |
| 20847 | for (var i = 0; i < node.length; i++) { |
| 20848 | var child = node[i]; |
| 20849 | if (isValidElement(child)) { |
| 20850 | validateExplicitKey(child, parentType); |
| 20851 | } |
| 20852 | } |
| 20853 | } else if (isValidElement(node)) { |
| 20854 | // This element was passed in a valid location. |
| 20855 | if (node._store) { |
| 20856 | node._store.validated = true; |
| 20857 | } |
| 20858 | } else if (node) { |
| 20859 | var iteratorFn = getIteratorFn(node); |
| 20860 | if (typeof iteratorFn === 'function') { |
| 20861 | // Entry iterators used to provide implicit keys, |
| 20862 | // but now we print a separate warning for them later. |
| 20863 | if (iteratorFn !== node.entries) { |
| 20864 | var iterator = iteratorFn.call(node); |
| 20865 | var step = void 0; |
| 20866 | while (!(step = iterator.next()).done) { |
| 20867 | if (isValidElement(step.value)) { |
| 20868 | validateExplicitKey(step.value, parentType); |
| 20869 | } |
| 20870 | } |
| 20871 | } |
| 20872 | } |
| 20873 | } |
| 20874 | } |
| 20875 | |
| 20876 | /** |
| 20877 | * Given an element, validate that its props follow the propTypes definition, |
no test coverage detected