wix-storybook-utils
Version:
Utilities for automated component documentation within Storybook
21 lines • 825 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.flatten = void 0;
var tslib_1 = require("tslib");
var isNested = function (item) { return item.type === 'object'; };
var flatten = function (methodsList, name) {
if (name === void 0) { name = ''; }
return methodsList
.filter(function (i) { return i && i.type; })
.reduce(function (list, item) {
if (isNested(item)) {
list = list.concat((0, exports.flatten)(item.props, name ? "".concat(name, ".").concat(item.name) : item.name));
}
else {
list.push(tslib_1.__assign(tslib_1.__assign({}, item), (name ? { name: "".concat(name, ".").concat(item.name) } : {})));
}
return list;
}, []);
};
exports.flatten = flatten;
//# sourceMappingURL=flatten.js.map