Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
devversion committed Mar 14, 2017
1 parent da03b48 commit 0a2d069
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
12 changes: 6 additions & 6 deletions tools/dgeni/processors/docs-private-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ const INTERNAL_METHODS = [
module.exports = function docsPrivateFilter() {
return {
$runBefore: ['categorizer'],
$process: docs => docs.filter(doc => validateDocEntry(doc))
$process: docs => docs.filter(doc => isPublicDoc(doc))
};
};

function validateDocEntry(doc) {
function isPublicDoc(doc) {
if (hasDocsPrivateTag(doc)) {
return false;
} else if (doc.docType === 'member') {
return validateMemberDoc(doc);
return !isInternalMember(doc);
} else if (doc.docType === 'class') {
doc.members = doc.members.filter(memberDoc => validateMemberDoc(memberDoc));
doc.members = doc.members.filter(memberDoc => isPublicDoc(memberDoc));
}

return true;
}

function validateMemberDoc(memberDoc) {
return !INTERNAL_METHODS.includes(memberDoc.name)
function isInternalMember(memberDoc) {
return INTERNAL_METHODS.includes(memberDoc.name)
}

function hasDocsPrivateTag(doc) {
Expand Down
11 changes: 9 additions & 2 deletions tools/dgeni/processors/link-inherited-docs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Processor that iterates through all class docs and determines if a class inherits
* another class. Inherited class-docs will be linked to the original class-doc.
*/

const ts = require('typescript');

module.exports = function linkInheritedDocs(readTypeScriptModules, tsParser) {
Expand All @@ -19,10 +24,12 @@ module.exports = function linkInheritedDocs(readTypeScriptModules, tsParser) {
checker = tsParser.parse(sourceFiles, basePath).typeChecker;

// Iterate through all class docs and resolve the inherited docs.
docs.filter(doc => doc.docType === 'class').forEach(classDoc => visitClassDoc(classDoc, docs));
docs.filter(doc => doc.docType === 'class').forEach(classDoc => {
resolveInheritedDoc(classDoc, docs);
});
}

function visitClassDoc(classDoc, docs) {
function resolveInheritedDoc(classDoc, docs) {
let inheritedType = resolveInheritedType(classDoc.exportSymbol);
let inheritedSymbol = inheritedType && inheritedType.symbol;

Expand Down

0 comments on commit 0a2d069

Please sign in to comment.