* 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)
| 1835 | |
| 1836 | |
| 1837 | function validateChildKeys(node, parentType) { |
| 1838 | if (typeof node !== 'object') { |
| 1839 | return; |
| 1840 | } |
| 1841 | |
| 1842 | if (Array.isArray(node)) { |
| 1843 | for (var i = 0; i < node.length; i++) { |
| 1844 | var child = node[i]; |
| 1845 | |
| 1846 | if (isValidElement(child)) { |
| 1847 | validateExplicitKey(child, parentType); |
| 1848 | } |
| 1849 | } |
| 1850 | } else if (isValidElement(node)) { |
| 1851 | // This element was passed in a valid location. |
| 1852 | if (node._store) { |
| 1853 | node._store.validated = true; |
| 1854 | } |
| 1855 | } else if (node) { |
| 1856 | var iteratorFn = getIteratorFn(node); |
| 1857 | |
| 1858 | if (typeof iteratorFn === 'function') { |
| 1859 | // Entry iterators used to provide implicit keys, |
| 1860 | // but now we print a separate warning for them later. |
| 1861 | if (iteratorFn !== node.entries) { |
| 1862 | var iterator = iteratorFn.call(node); |
| 1863 | var step; |
| 1864 | |
| 1865 | while (!(step = iterator.next()).done) { |
| 1866 | if (isValidElement(step.value)) { |
| 1867 | validateExplicitKey(step.value, parentType); |
| 1868 | } |
| 1869 | } |
| 1870 | } |
| 1871 | } |
| 1872 | } |
| 1873 | } |
| 1874 | /** |
| 1875 | * Given an element, validate that its props follow the propTypes definition, |
| 1876 | * provided by the type. |
no test coverage detected