storybook-readme
Version:
Storybook addon to show components README (for React and Vue)
34 lines (27 loc) • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.excludePropTable = void 0;
// Exclude propTables according to the user inputs(excludePropTables,
// includePropTables) It prioritizes includePropTables over excludePropTables.
// User can exclude propTables globally for convenience and it is possible to
// include it from a specific story by prioritizing include rule.
var excludePropTable = function excludePropTable(innerChildren, excludePropTables, includePropTables) {
var isComponentInExcludePropTables = excludePropTables.some(function (component) {
return component === innerChildren.type;
});
var isComponentInIncludePropTables = includePropTables.some(function (component) {
return component === innerChildren.type;
}); // If nothings are in includePropTables, then excludePropTables decides
// whether this component should be excluded or not.
if (includePropTables.length === 0 && isComponentInExcludePropTables) {
return true;
} // If somethings are in includePropTables, then it only includes components
// that are in incluePropTables and ignores excludePropTables at all.
if (includePropTables.length > 0 && !isComponentInIncludePropTables) {
return true;
}
return false;
};
exports.excludePropTable = excludePropTable;