* 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)
| 19531 | * @param {*} parentType node's parent's type. |
| 19532 | */ |
| 19533 | function validateChildKeys(node, parentType) { |
| 19534 | if (typeof node !== 'object') { |
| 19535 | return; |
| 19536 | } |
| 19537 | if (Array.isArray(node)) { |
| 19538 | for (var i = 0; i < node.length; i++) { |
| 19539 | var child = node[i]; |
| 19540 | if (isValidElement(child)) { |
| 19541 | validateExplicitKey(child, parentType); |
| 19542 | } |
| 19543 | } |
| 19544 | } else if (isValidElement(node)) { |
| 19545 | // This element was passed in a valid location. |
| 19546 | if (node._store) { |
| 19547 | node._store.validated = true; |
| 19548 | } |
| 19549 | } else if (node) { |
| 19550 | var iteratorFn = getIteratorFn(node); |
| 19551 | if (typeof iteratorFn === 'function') { |
| 19552 | // Entry iterators used to provide implicit keys, |
| 19553 | // but now we print a separate warning for them later. |
| 19554 | if (iteratorFn !== node.entries) { |
| 19555 | var iterator = iteratorFn.call(node); |
| 19556 | var step = void 0; |
| 19557 | while (!(step = iterator.next()).done) { |
| 19558 | if (isValidElement(step.value)) { |
| 19559 | validateExplicitKey(step.value, parentType); |
| 19560 | } |
| 19561 | } |
| 19562 | } |
| 19563 | } |
| 19564 | } |
| 19565 | } |
| 19566 | |
| 19567 | /** |
| 19568 | * Given an element, validate that its props follow the propTypes definition, |
no test coverage detected