* 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 pa
(node, parentType)
| 2195 | |
| 2196 | |
| 2197 | function validateChildKeys(node, parentType) { |
| 2198 | if (typeof node !== 'object') { |
| 2199 | return; |
| 2200 | } |
| 2201 | |
| 2202 | if (isArray(node)) { |
| 2203 | for (var i = 0; i < node.length; i++) { |
| 2204 | var child = node[i]; |
| 2205 | |
| 2206 | if (isValidElement(child)) { |
| 2207 | validateExplicitKey(child, parentType); |
| 2208 | } |
| 2209 | } |
| 2210 | } else if (isValidElement(node)) { |
| 2211 | // This element was passed in a valid location. |
| 2212 | if (node._store) { |
| 2213 | node._store.validated = true; |
| 2214 | } |
| 2215 | } else if (node) { |
| 2216 | var iteratorFn = getIteratorFn(node); |
| 2217 | |
| 2218 | if (typeof iteratorFn === 'function') { |
| 2219 | // Entry iterators used to provide implicit keys, |
| 2220 | // but now we print a separate warning for them later. |
| 2221 | if (iteratorFn !== node.entries) { |
| 2222 | var iterator = iteratorFn.call(node); |
| 2223 | var step; |
| 2224 | |
| 2225 | while (!(step = iterator.next()).done) { |
| 2226 | if (isValidElement(step.value)) { |
| 2227 | validateExplicitKey(step.value, parentType); |
| 2228 | } |
| 2229 | } |
| 2230 | } |
| 2231 | } |
| 2232 | } |
| 2233 | } |
| 2234 | /** |
| 2235 | * Given an element, validate that its props follow the propTypes definition, |
| 2236 | * provided by the type. |
no test coverage detected
searching dependent graphs…