UNPKG

@builder.io/mitosis

Version:

Write components once, run everywhere. Compiles to Vue, React, Solid, and Liquid. Import code from Figma and Builder.io

23 lines (22 loc) 956 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseProperties = void 0; function parseProperties(json, node) { var _a, _b; const declarations = (_a = node.declaration) === null || _a === void 0 ? void 0 : _a.declarations; if (declarations === null || declarations === void 0 ? void 0 : declarations.length) { const declaration = declarations[0]; const property = declaration.id.name; const value = (_b = declaration.init) === null || _b === void 0 ? void 0 : _b.value; const propertyObject = { [property]: { default: value, }, }; json.props = { ...json.props, ...propertyObject }; json.defaultProps = Object.fromEntries(Object.keys(json.props) .filter((key) => json.props[key].default) .map((key) => [key, json.props[key].default])); } } exports.parseProperties = parseProperties;