wix-storybook-utils
Version:
Utilities for automated component documentation within Storybook
17 lines • 675 B
JavaScript
import { __assign } from "tslib";
var isNested = function (item) { return item.type === 'object'; };
export 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(flatten(item.props, name ? "".concat(name, ".").concat(item.name) : item.name));
}
else {
list.push(__assign(__assign({}, item), (name ? { name: "".concat(name, ".").concat(item.name) } : {})));
}
return list;
}, []);
};
//# sourceMappingURL=flatten.js.map