MCPcopy Create free account
hub / github.com/plotly/dash / isNode

Function isNode

dash/deps/prop-types@15.8.1.js:647–692  ·  view source on GitHub ↗
(propValue)

Source from the content-addressed store, hash-verified

645 }
646
647 function isNode(propValue) {
648 switch (typeof propValue) {
649 case 'number':
650 case 'string':
651 case 'undefined':
652 return true;
653 case 'boolean':
654 return !propValue;
655 case 'object':
656 if (Array.isArray(propValue)) {
657 return propValue.every(isNode);
658 }
659 if (propValue === null || isValidElement(propValue)) {
660 return true;
661 }
662
663 var iteratorFn = getIteratorFn(propValue);
664 if (iteratorFn) {
665 var iterator = iteratorFn.call(propValue);
666 var step;
667 if (iteratorFn !== propValue.entries) {
668 while (!(step = iterator.next()).done) {
669 if (!isNode(step.value)) {
670 return false;
671 }
672 }
673 } else {
674 // Iterator will provide entry [k,v] tuples rather than values.
675 while (!(step = iterator.next()).done) {
676 var entry = step.value;
677 if (entry) {
678 if (!isNode(entry[1])) {
679 return false;
680 }
681 }
682 }
683 }
684 } else {
685 return false;
686 }
687
688 return true;
689 default:
690 return false;
691 }
692 }
693
694 function isSymbol(propType, propValue) {
695 // Native Symbol.

Callers 1

validateFunction · 0.85

Calls 2

isValidElementFunction · 0.70
getIteratorFnFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…