MCPcopy
hub / github.com/plotly/dash / getProps

Function getProps

dash/extract-meta.js:606–653  ·  view source on GitHub ↗
(
        properties,
        propsObj,
        baseProps = [],
        defaultProps = {},
        flat = false,
        parentType = null,
    )

Source from the content-addressed store, hash-verified

604 };
605
606 const getProps = (
607 properties,
608 propsObj,
609 baseProps = [],
610 defaultProps = {},
611 flat = false,
612 parentType = null,
613 ) => {
614 const results = {};
615
616 properties.forEach(prop => {
617 const name = prop.getName();
618 if (isReservedPropName(name)) {
619 return;
620 }
621 const propType = checker.getTypeOfSymbolAtLocation(
622 prop,
623 propsObj.valueDeclaration
624 );
625 const baseProp = baseProps.find(p => p.getName() === name);
626 const defaultValue = defaultProps[name];
627
628 const required =
629 !isOptional(prop) &&
630 (!baseProp || !isOptional(baseProp)) &&
631 defaultValue === undefined;
632
633 const description = getPropComment(prop);
634
635 let result = {
636 description,
637 required,
638 defaultValue
639 };
640 const type = getPropType(propType, propsObj, parentType);
641 // root object is inserted as type,
642 // otherwise it's flat in the value prop.
643 if (!flat) {
644 result.type = type;
645 } else {
646 result = {...result, ...type};
647 }
648
649 results[name] = result;
650 });
651
652 return results;
653 };
654
655 const getPropInfo = (propsObj, defaultProps) => {
656 const propsType = checker.getTypeOfSymbolAtLocation(

Callers 3

getPropTypeFunction · 0.70
getPropInfoFunction · 0.70

Calls 5

isReservedPropNameFunction · 0.85
isOptionalFunction · 0.85
getPropCommentFunction · 0.85
findMethod · 0.80
getPropTypeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…