@builder.io/mitosis
Version:
Write components once, run everywhere. Compiles to Vue, React, Solid, and Liquid. Import code from Figma and Builder.io
22 lines (21 loc) • 695 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultProps = void 0;
const getDefaultProps = (json) => {
if (!json.defaultProps)
return '';
const defaultPropsString = Object.keys(json.defaultProps)
.map((prop) => {
var _a;
const value = json.defaultProps.hasOwnProperty(prop)
? (_a = json.defaultProps[prop]) === null || _a === void 0 ? void 0 : _a.code
: 'undefined';
return `${prop}: ${value}`;
})
.join(',');
if (defaultPropsString) {
return `props = {${defaultPropsString}, ...props}`;
}
return '';
};
exports.getDefaultProps = getDefaultProps;
;