MCPcopy Create free account
hub / github.com/Lobos/react-ui / isNode

Function isNode

docs/lib/react.js:12778–12823  ·  view source on GitHub ↗
(propValue)

Source from the content-addressed store, hash-verified

12776}
12777
12778function isNode(propValue) {
12779 switch (typeof propValue) {
12780 case 'number':
12781 case 'string':
12782 case 'undefined':
12783 return true;
12784 case 'boolean':
12785 return !propValue;
12786 case 'object':
12787 if (Array.isArray(propValue)) {
12788 return propValue.every(isNode);
12789 }
12790 if (propValue === null || ReactElement.isValidElement(propValue)) {
12791 return true;
12792 }
12793
12794 var iteratorFn = getIteratorFn(propValue);
12795 if (iteratorFn) {
12796 var iterator = iteratorFn.call(propValue);
12797 var step;
12798 if (iteratorFn !== propValue.entries) {
12799 while (!(step = iterator.next()).done) {
12800 if (!isNode(step.value)) {
12801 return false;
12802 }
12803 }
12804 } else {
12805 // Iterator will provide entry [k,v] tuples rather than values.
12806 while (!(step = iterator.next()).done) {
12807 var entry = step.value;
12808 if (entry) {
12809 if (!isNode(entry[1])) {
12810 return false;
12811 }
12812 }
12813 }
12814 }
12815 } else {
12816 return false;
12817 }
12818
12819 return true;
12820 default:
12821 return false;
12822 }
12823}
12824
12825// Equivalent of `typeof` but with special handling for array and regexp.
12826function getPropType(propValue) {

Callers 2

validateFunction · 0.85
isTextNodeFunction · 0.85

Calls 2

getIteratorFnFunction · 0.85
nextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…