* 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)
| 9364 | * @param {*} parentType node's parent's type. |
| 9365 | */ |
| 9366 | function validateChildKeys(node, parentType) { |
| 9367 | if (typeof node !== 'object') { |
| 9368 | return; |
| 9369 | } |
| 9370 | if (Array.isArray(node)) { |
| 9371 | for (var i = 0; i < node.length; i++) { |
| 9372 | var child = node[i]; |
| 9373 | if (ReactElement.isValidElement(child)) { |
| 9374 | validateExplicitKey(child, parentType); |
| 9375 | } |
| 9376 | } |
| 9377 | } else if (ReactElement.isValidElement(node)) { |
| 9378 | // This element was passed in a valid location. |
| 9379 | if (node._store) { |
| 9380 | node._store.validated = true; |
| 9381 | } |
| 9382 | } else if (node) { |
| 9383 | var iteratorFn = getIteratorFn(node); |
| 9384 | // Entry iterators provide implicit keys. |
| 9385 | if (iteratorFn) { |
| 9386 | if (iteratorFn !== node.entries) { |
| 9387 | var iterator = iteratorFn.call(node); |
| 9388 | var step; |
| 9389 | while (!(step = iterator.next()).done) { |
| 9390 | if (ReactElement.isValidElement(step.value)) { |
| 9391 | validateExplicitKey(step.value, parentType); |
| 9392 | } |
| 9393 | } |
| 9394 | } |
| 9395 | } |
| 9396 | } |
| 9397 | } |
| 9398 | |
| 9399 | /** |
| 9400 | * Assert that the props are valid |
no test coverage detected