aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-docs/src/docs_info.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-09-28 01:51:30 +0800
committerFabio Berger <me@fabioberger.com>2018-09-28 01:51:30 +0800
commitdddfe8ae50f315159143dfbd8e5dbfaf75de9210 (patch)
tree62d95dca77e63c382e9ca6cb370f9d0c94390ec3 /packages/react-docs/src/docs_info.ts
parentc0498944c38e827dc69f369dd1427df43b23c9a9 (diff)
downloaddexon-sol-tools-dddfe8ae50f315159143dfbd8e5dbfaf75de9210.tar
dexon-sol-tools-dddfe8ae50f315159143dfbd8e5dbfaf75de9210.tar.gz
dexon-sol-tools-dddfe8ae50f315159143dfbd8e5dbfaf75de9210.tar.bz2
dexon-sol-tools-dddfe8ae50f315159143dfbd8e5dbfaf75de9210.tar.lz
dexon-sol-tools-dddfe8ae50f315159143dfbd8e5dbfaf75de9210.tar.xz
dexon-sol-tools-dddfe8ae50f315159143dfbd8e5dbfaf75de9210.tar.zst
dexon-sol-tools-dddfe8ae50f315159143dfbd8e5dbfaf75de9210.zip
Add typeSectionName to docsInfo so we don't use hard-coded "Types"
Diffstat (limited to 'packages/react-docs/src/docs_info.ts')
-rw-r--r--packages/react-docs/src/docs_info.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts
index 6355a2f88..bf6aa07a7 100644
--- a/packages/react-docs/src/docs_info.ts
+++ b/packages/react-docs/src/docs_info.ts
@@ -18,6 +18,7 @@ export class DocsInfo {
public packageName: string;
public packageUrl: string;
public menu: DocsMenu;
+ public typeSectionName: string;
public sections: SectionsMap;
public sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion;
public contractsByVersionByNetworkId?: ContractsByVersionByNetworkId;
@@ -28,6 +29,7 @@ export class DocsInfo {
this.displayName = config.displayName;
this.packageName = config.packageName;
this.packageUrl = config.packageUrl;
+ this.typeSectionName = config.type === SupportedDocJson.SolDoc ? 'structs' : 'types';
this.sections = config.markdownSections;
this.sectionNameToMarkdownByVersion = config.sectionNameToMarkdownByVersion;
this.contractsByVersionByNetworkId = config.contractsByVersionByNetworkId;
@@ -53,7 +55,7 @@ export class DocsInfo {
_.isEmpty(docSection.properties) &&
_.isEmpty(docSection.events);
- if (!_.isUndefined(this.sections.types) && sectionName === this.sections.types) {
+ if (sectionName === this.typeSectionName) {
const sortedTypesNames = _.sortBy(docSection.types, 'name');
const typeNames = _.map(sortedTypesNames, t => t.name);
menuSubsectionsBySection[sectionName] = typeNames;
@@ -86,8 +88,8 @@ export class DocsInfo {
return {};
}
- const typeDocSection = docAgnosticFormat[this.sections.types];
- const typeDefinitionByName = _.keyBy(typeDocSection.types, 'name') as any;
+ const section = docAgnosticFormat[this.sections.types];
+ const typeDefinitionByName = _.keyBy(section.types, 'name') as any;
return typeDefinitionByName;
}
}