UNPKG

1.36 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.buildFilter = void 0;
4function buildFilter(opts) {
5 return function (prop, component) {
6 var propFilter = opts.propFilter;
7 // skip children property in case it has no custom documentation
8 if (prop.name === 'children' &&
9 prop.description.length === 0 &&
10 opts.skipChildrenPropWithoutDoc !== false) {
11 return false;
12 }
13 if (typeof propFilter === 'function') {
14 var keep = propFilter(prop, component);
15 if (!keep) {
16 return false;
17 }
18 }
19 else if (typeof propFilter === 'object') {
20 var _a = propFilter, skipPropsWithName = _a.skipPropsWithName, skipPropsWithoutDoc = _a.skipPropsWithoutDoc;
21 if (typeof skipPropsWithName === 'string' &&
22 skipPropsWithName === prop.name) {
23 return false;
24 }
25 else if (Array.isArray(skipPropsWithName) &&
26 skipPropsWithName.indexOf(prop.name) > -1) {
27 return false;
28 }
29 if (skipPropsWithoutDoc && prop.description.length === 0) {
30 return false;
31 }
32 }
33 return true;
34 };
35}
36exports.buildFilter = buildFilter;
37//# sourceMappingURL=buildFilter.js.map
\No newline at end of file