MCPcopy Create free account
hub / github.com/reactjs/react-rails / isNode

Function isNode

lib/assets/react-source/development/react.js:30866–30911  ·  view source on GitHub ↗
(propValue)

Source from the content-addressed store, hash-verified

30864 }
30865
30866 function isNode(propValue) {
30867 switch (typeof propValue) {
30868 case 'number':
30869 case 'string':
30870 case 'undefined':
30871 return true;
30872 case 'boolean':
30873 return !propValue;
30874 case 'object':
30875 if (Array.isArray(propValue)) {
30876 return propValue.every(isNode);
30877 }
30878 if (propValue === null || isValidElement(propValue)) {
30879 return true;
30880 }
30881
30882 var iteratorFn = getIteratorFn(propValue);
30883 if (iteratorFn) {
30884 var iterator = iteratorFn.call(propValue);
30885 var step;
30886 if (iteratorFn !== propValue.entries) {
30887 while (!(step = iterator.next()).done) {
30888 if (!isNode(step.value)) {
30889 return false;
30890 }
30891 }
30892 } else {
30893 // Iterator will provide entry [k,v] tuples rather than values.
30894 while (!(step = iterator.next()).done) {
30895 var entry = step.value;
30896 if (entry) {
30897 if (!isNode(entry[1])) {
30898 return false;
30899 }
30900 }
30901 }
30902 }
30903 } else {
30904 return false;
30905 }
30906
30907 return true;
30908 default:
30909 return false;
30910 }
30911 }
30912
30913 function isSymbol(propType, propValue) {
30914 // Native Symbol.

Callers 1

validateFunction · 0.70

Calls 2

isValidElementFunction · 0.70
getIteratorFnFunction · 0.70

Tested by

no test coverage detected