aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-docs/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-18 07:09:04 +0800
committerFabio Berger <me@fabioberger.com>2018-08-18 07:09:04 +0800
commitfb637d92347917528e0955e291da5d07006f28e2 (patch)
treed8f49679054fac12d89f1722e1e0bc01f01717c9 /packages/react-docs/src
parent0f7ced3625417f0de14d3158551971d1b558fa2e (diff)
downloaddexon-sol-tools-fb637d92347917528e0955e291da5d07006f28e2.tar.gz
dexon-sol-tools-fb637d92347917528e0955e291da5d07006f28e2.tar.zst
dexon-sol-tools-fb637d92347917528e0955e291da5d07006f28e2.zip
Make sure we don't render protected properties
Diffstat (limited to 'packages/react-docs/src')
-rw-r--r--packages/react-docs/src/utils/typedoc_utils.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts
index 989485dfc..8ee76c98c 100644
--- a/packages/react-docs/src/utils/typedoc_utils.ts
+++ b/packages/react-docs/src/utils/typedoc_utils.ts
@@ -76,6 +76,9 @@ export class TypeDocUtils {
public isProperty(entity: TypeDocNode): boolean {
return entity.kindString === KindString.Property;
}
+ public isUnderscorePrefixed(name: string): boolean {
+ return _.startsWith(name, '_');
+ }
public getModuleDefinitionsBySectionName(versionDocObj: TypeDocNode, configModulePaths: string[]): TypeDocNode[] {
const moduleDefinitions: TypeDocNode[] = [];
const jsonModules = versionDocObj.children;
@@ -189,8 +192,7 @@ export class TypeDocUtils {
case KindString.Function:
if (entity.flags.isExported) {
const funcName = (entity as TypeDocNode).signatures[0].name;
- const isPublicFunc = !_.startsWith(funcName, '_');
- if (isPublicFunc) {
+ if (!this.isUnderscorePrefixed(funcName)) {
const func = this._convertFunction(entity, sectionName, isClassOrObjectLiteral);
docSection.functions.push(func);
}
@@ -198,7 +200,7 @@ export class TypeDocUtils {
break;
case KindString.Method:
- if (entity.flags.isPublic) {
+ if (entity.flags.isPublic && !this.isUnderscorePrefixed(entity.name)) {
isConstructor = false;
const method = this._convertMethod(entity, isConstructor, sectionName);
docSection.methods.push(method);
@@ -206,8 +208,10 @@ export class TypeDocUtils {
break;
case KindString.Property: {
- const property = this._convertProperty(entity, sectionName);
- docSection.properties.push(property);
+ if (!this.isUnderscorePrefixed(entity.name)) {
+ const property = this._convertProperty(entity, sectionName);
+ docSection.properties.push(property);
+ }
break;
}